Forum Moderators: open

Message Too Old, No Replies

duplicate records with a value of 1 in a specific column

need a sql statement to filter the duplicate records that also have a 1

         

vipina

12:52 am on Nov 18, 2005 (gmt 0)

10+ Year Member



say that i have a four column table and i want my output to contain all records minus the duplicates that have a value of 0 in the fourth column. the fourth column can contain only a 0 or a 1.

thanks.

arran

1:39 am on Nov 18, 2005 (gmt 0)

10+ Year Member



If I understand you correctly, you may want something like:

select distinct column1, column2, column3 from table where column4 <> 0

arran.

vipina

1:56 am on Nov 18, 2005 (gmt 0)

10+ Year Member



Thank you. This may work but can I select unique on two columns (c1 and c2) so something like :

select distinct (c1, c2) ,c3, c4 from table where c4 <> 0;

but will this filter out the rows that do have a 0 in c4 but are not duplicates?

vipin

syber

2:50 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



Could you show an example of a few rows of data with some duplicates and what you expect to get back?