Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with UNION SELECT not returning all results 1

Status
Not open for further replies.

StewartUK

Programmer
Feb 19, 2001
860
0
0
GB
I have the following SQL statement (in VFP8 SP1):
Code:
SELECT ALL ObjectPic AS Pic FROM Relations WHERE ObjectPic = [VINCE123PR] ;
UNION SELECT ALL SubjectPic AS Pic FROM Relations WHERE SubjectPic = [VINCE123PR]
In the table Relations, the string VINCE123PR appears 13 times in field ObjectPic and 8 times in field SubjectPic.

I thought the "ALL" keyword prevented elimination of duplicates - here's what the help says
ALL prevents UNION from eliminating duplicate rows from the combined results.
- however the above statement only returns 1 record.


Can someone tell me (a) what's wrong and (b) how to get all 21 records?

Thanks,

Stewart
 
Stewart,

I hope this help:

Try UNION ALL (SELECT...) instead of UNION SELECT ALL...

Germán Restrepo
Bogotá, Colombia
 
Thanks German, have a star.

I had another look at the help and realised that it said that all along - doh.

Stewart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top