Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Top...
Message
De
14/12/2007 15:57:16
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
14/12/2007 15:38:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01275969
Message ID:
01275990
Vues:
6
>>>>>I don't know if this is doable.
>>>>>
>>>>>
>>>>>SELECT TOP 10 demo.idcard, hra.hraid, hraspec.hracomplet ;
>>>>>	FROM demo d, hra h1, hraspec h2 ;
>>>>>	WHERE d.ssnum = h1.ssnum ;
>>>>>		AND h1.hraid = h2.hraid ORDER BY 1
>>>>>
>>>>>
>>>>>I want to extract first to 10 rolls from demo and their related records from hra and hraspec. I can't get it to work.
>>>>>
>>>>>What am I doing wrong.
>>>>>
>>>>>Thanks
>>>>
>>>>How about separating the commands? First, get the top 10 records, then join the result with other tables.
>>>
>>>
>>>Yes. I know.
>>>I thought there is a way to do it in one step.
>>>
>>>thank tho.
>>
>>Oh, one more thing. In times of old, I used to combine several tables into a single SELECT statement, until I found that separating it into several parts (join 2 table, join the result with a third table...) could DRASTICALLY speed up the queries.
>
>Thanks. I agree. But I'm stubborn. :)

Right. By the way, another stubborn habit which you are better off changing is the following: it is better to use JOIN syntax instead of WHERE, to specify how you join the table. Advantages are:
  • It is clearer how the tables are joint; which commands are for joining, as opposed to additional filters.
  • You can easily change an inner join to another join. This is much more complicated with the old syntax.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform