Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UNION and order
Message
De
26/04/1999 14:21:53
 
 
À
26/04/1999 14:18:17
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:
00212244
Vues:
23
Ed, sshhhhhh!

We're not supposed to use APPEND anything anymore :-D


>The most funny thing is that the problem could be and should be solved by APPEND FROM.
>
>>Hiya Ed.
>>
>>Haha. I liked your guys solutions better, I was just posting a "hmmmm" type of comment.
>>
>>
>>>Josh, gave you one hit, I do another one :-). Without UNION ALL you take good chances to miss many records.
>>>
>>>>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
Répondre
Fil
Voir

Click here to load this message in the networking platform