I have a table like this:
Item ProviderId
Item1 1
Item1 2
Item2 1
Item3 1
I wish to get a new table. In the new table, it only lists the items who has at least two different ProviderIds.
So in the above example, since only item1 has two different ProviderId I wish to get table like this:
Item
Item1
How can I write the statement to do this?
You have to use
group byandhaving:or without
distinctsql fiddle demo
With query as table:
If you want to create new table, you can use
into: