sql - PostgreSQL: how to use NOT IN without WHERE? -


i have 2 queries:

select *  tablea 

and

select a,b tablea group a,b 

the first query returns 2101 rows second query returns 2100 rows

i want know row in first not in second. should simple not in, can't find correct syntax not in should in where statement. don't have where statement in case.

there n ways , 1 of simplest should find rows have count > 1 when grouped on a,b.

select a,b tablea group a,b having count(*) > 1 

here sample:

with tablea  (     select * (values       (1,1,1),       (1,1,1),       (1,2,1)      ) t(a,b,c) )  select a, b tablea group a, b having count(*) > 1; 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -