Tilsley, Jerry M. <[email protected]> wrote:
> I'm sure this is a pretty lame question, but my thinking hat is 
> malfunctioning this morning.  How can I select all rows from a
> table where a specific column is NOT UNIQUE?

select * from MyTable where SpecificColumn in (
  select SpecificColumn from MyTable
  group by SpecificColumn
  having count(*) > 1);

-- or

select * from MyTable t1 where exists (
  select 1 from MyTable t2
  where t2.SpecificColumn = t1.SpecificColumn and t2.rowid != t1.rowid);

-- or

select * from MyTable t1 where 1 < (
  select count(*) from MyTable t2
  where t2.SpecificColumn = t1.SpecificColumn);

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to