sql - What do i wrong? -


http://sqlfiddle.com/#!6/30c6fe/4

here code:

    create table employees (   id integer identity(1,1) primary key,   lastname varchar (16),   pass_num varchar (16)  ) ;    insert employees values ('ivanov', '11111111');   insert employees values ('ivanov', '11111111');   insert employees values ('ivanov', '55555555');   insert employees values ('petrov', '22222222');   insert employees values ('petrov', '22222222');   insert employees values ('sidorov', '11111111');  select id, lastname, pass_num employees emp group lastname, pass_num having min(id); 

and error: expression of non-boolean type specified in context condition expected, near ')'.

you have error on

having min(id); 

it expecting expression

sample

having min(id) = 1; 

also, group not include columns not in aggregate function. should include column id well

group lastname, pass_num 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -