Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper syntax when using UNION
Message
From
24/01/2002 15:31:48
 
 
To
24/01/2002 15:26:09
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00609414
Message ID:
00610057
Views:
15
I must admit that I have missed something:
The correct command will be
SELECT NOCLIENT AS O_NOCLIENT ,NOCAT AS O_NOCAT,NUMERO,NOMEMBER,NOPARENT AS O_NOPARENT,NOTHREAD AS O_NOTHREAD,ADDDATE,ADDHEURE,TITLE,.T. AS FLAG,1 AS ORDERF ;
 FROM THREAD WHERE NoClient=5 AND NUMERO>=600000;
UNION SELECT NOCLIENT AS O_NOCLIENT ,NOCAT AS O_NOCAT,NUMERO,NOMEMBER,NOPARENT AS O_NOPARENT,NOTHREAD AS O_NOTHREAD,ADDDATE,ADDHEURE,TITLE,.T. AS FLAG,0 AS ORDERF;
 FROM THREAD WHERE NoClient<>5 AND NUMERO>=600000;
 ORDER BY ORDERF DESCENDING,O_NOCLIENT,O_NOCAT,O_NOTHREAD,O_NOPARENT INTO CURSOR TEMP READWRITE
So If you wish to use order by with names you should have additional AS clauses with names different from your field names.

I have tested it with only one order by clause and this was why I did not post you the correct query the first time
Zlatin Zlatev,
MCSD (VS6)

Make solutions, not programs!

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform