MySQL Forums
Forum List  »  Newbie

SQL Query help
Posted by: Peter Cabrera
Date: November 01, 2007 11:02AM

Ok, so this is my question.

I have a Table in which one value can be repeated 2 times at the most. The fact is that i need to find just the values in which column 2 has a specific value and the register at column 1 is NOT repeated.

Supose this:
column1   |   column2
----------+-------------
123       |     0   
123       |     1          <--- the value of "123" is repeated so we dont want it.
456       |     0   
789       |     0   
111       |     1           <--- this is not repeated but it has a value of "1" at col2 so we dont want it neither.

How can i find all the "0" (zeroes) in which there exist one and only one row for each col1 value (the value at col1 is not repeated).

In the given example the values im looking for are "456" and "789".

Thanks for the help and sorry for the poor english.



Edited 2 time(s). Last edit at 11/01/2007 11:08AM by Peter Cabrera.

Options: ReplyQuote


Subject
Written By
Posted
SQL Query help
November 01, 2007 11:02AM
November 01, 2007 11:35AM
November 01, 2007 02:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.