Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UNION and order
Message
De
26/04/1999 13:58:48
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00212225
Message ID:
00212228
Vues:
22
Hi Josh ----

I could be wrong, but if you just do:

SELECT * FROM table1 UNION SELECT * FROM table2 UNION SELECT * FROM table3

With no ORDER clause, isn't the order pretty much automatically 1,2,3 in the results set?




>
>If you just want all the table 1 records, then table 2, then table 3 and don't care what order they're in within each table, you can do this:
>
>SELECT '1',* FROM table1 ;
>UNION ;
>SELECT '2',* FROM table2 ;
>UNION ;
>SELECT '3', * FROM table3 ;
>   ORDER BY 1
You can also make this work if you have other columns that you can use to sort the data within each table.
>
>>I'd like to combine 3 tables using UNION. But I dont need any order, I'd like to keep records in order they come from tables:
>>table1, table2, table3.
>>Is it possible?
>>Thanks Mark
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform