On 8 November 2012 11:23, e-mail mgbg25171 <mgbg25...@blueyonder.co.uk> wrote:
> I'm using SQLIte.
> All columns can have duplicate values but it would be helpful to report
> on those rows which are identical across all columns.
> More specifically I'm looking for matching itm values where the first 3
> cols ALSO match but am not sure of the sqlite select query to do this.
>
> epic, yr, statement, itm
> ==================
> mcro, 2002, income, revs
> mcro, 2002, income, cogs
> mcro, 2002, income, sg&a
> mcro, 2002, income, cogs
> mcro, 2003, balance, gdwil
> etc
>
> in the example I'm looking for a query that would return
> mcro, 2002, income, cogs
> mcro, 2002, income, cogs

select * from t natural join ( select epic, yr, statement, itm from t
group by epic, yr, statement, itm having count(*) > 1 ) t1;

>
> any help much appreciated
>
> BTW no field can be unique in the createtable statement


Regards,
Simon
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to