Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL SELECT help needed.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL SELECT help needed.
Miscellaneous
Thread ID:
00401104
Message ID:
00401104
Views:
70
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
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform