General information
Category:
Coding, syntax & commands
Steve: This query works for the specific data you've provided. I'm not sure if it will work in all cases though
SELECT * FROM table ;
WHERE NOT EMPTY(Field3);
OR ;
Field1 IN (SELECT Field1 FROM table GROUP BY Field1 HAVING COUNT(*) = 1)
>I SELECTing records in a table, but don't know how to get what I want. Here's what I am SELECTing:
>
>Field1 Field2 Field3 Field4
>100 A
>100 A A A
>200 A
>200 A A A
>300 A
>300 A A A
>300 A B B
>400 A
>500 A
>500 A A A
>
>I want to discard all records that are EMPTY(Field3) AND
>EMPTY(Field4) AND also have a duplicate number in Field1 like where Field1 = 100 and Field1 = 200 and Field1 = 300 and Field1 = 500. The first record of all those sets of records would be discarded. I would only SELECT all the records after the first record of those sets.
>But I don't want to discard any records where Field 1 does not have a duplicate number in Field1 like where Field1 = 400. I would want to select the one and only record for Field1 = 400.
>
>So the result of my SELECT would be:
>
>Field1 Field2 Field3 Field4
>100 A A A
>200 A A A
>300 A A A
>300 A B B
>400 A
>500 A A A
>
>How can I do this with a SELECT? TIA
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only