Example: DROP TABLE IF EXISTS TEST; Update count: 0 (0 ms)
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255), CAT1 VARCHAR(255), CAT2 VARCHAR(255)); Update count: 0 (0 ms) INSERT INTO TEST VALUES(1, 'Hello','A','B'); Update count: 1 (15 ms) INSERT INTO TEST VALUES(2, 'World','B','A'); Update count: 1 (16 ms) INSERT INTO TEST VALUES(3, 'Hello','A','A'); Update count: 1 (0 ms) SELECT * FROM TEST ORDER BY ID; ID NAME CAT1 CAT2 1 Hello A B 2 World B A 3 Hello A A (3 rows, 0 ms) SELECT COUNT(NAME) as C FROM TEST HAVING COUNT(NAME) = 1; C (no rows, 0 ms) >>>> in above it should return 1 for name='World' SELECT COUNT(*) AS C,CAT1,CAT2 FROM TEST WHERE CAT1 IS NOT NULL GROUP BY CAT1,CAT2 ORDER BY CAT1.CAT2; C CAT1 CAT2 1 B A 1 A A 1 A B (3 rows, 0 ms) >>>> in above it should throw there is no table/alias called CAT1 I do not have time really to setup and test this in another DBs Thanks for quick reply, Nitin On Aug 20, 3:05 pm, Thomas Mueller <[email protected]> wrote: > Hi, > > Please provide complete examples, and try with other databases as well. > > Regards, > Thomas -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
