Hi
this is a simplified example:

CREATE TABLE foo (id number PRIMARY KEY, label varchar2)
CREATE TABLE bar (id number PRIMARY KEY, label varchar2)

INSERT INTO foo(id, label) VALUES (1,'one')
INSERT INTO foo(id, label) VALUES (2,'one')
INSERT INTO foo(id, label) VALUES (3,'two')
-- INSERT INTO bar(id, label) VALUES (2, 'two')
INSERT INTO bar(id, label) VALUES (4, 'three')

SELECT foo.label, max(foo.id) AS maxid, bar.label
FROM foo
left outer join bar on foo.id=bar.id
GROUP BY foo.label

with the commented out insert, I have no errors (and the obvious result of 

LABEL|MAXID|LABEL|
-----|-----|-----|
one  |    2|     |
two  |    3|     |

but with the insert the join will have the error "SQL Error [90016] 
[90016]: Column "BAR.LABEL" must be in the GROUP BY list; SQL statement:
SELECT foo.label, max(foo.id) AS maxid, bar.label
FROM foo
left outer join bar on foo.id=bar.id
GROUP BY foo.label [90016-200]"

I know that the error is in the query (i need to add bar.label to the GROUP 
BY or use a reducing function in the column)

but WHY I don't have this check "statically" before the query has been 
effectively run?
Is there a way to force the check even on empty tables?


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/40a1f234-95ab-4c89-9bf9-66f0005fc438n%40googlegroups.com.

Reply via email to