Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UNION SELECT... please correct me
Message
De
27/10/1998 07:54:20
 
 
À
27/10/1998 07:20:18
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00150818
Message ID:
00150844
Vues:
16
>Denis,
>Top n requires "order by" and you can't use two "order by" for a union. Unfortunately you should divide it into 3 SQLs (if ever there is a better way I don't know it).
SELECT TOP 1 * ;
>  FROM myDatabase!myTable ;
>  WHERE myTable.cod = pCod ;
>  AND myTable.price >=pPrice ;
>  into cursor crsPass1 ;
>ORDER BY mytable.price
>
>SELECT TOP 1 * ;
>  FROM myDatabase!myTable ;
>  WHERE myTable.cod = pCod ;
>  AND myTable.price <=pPrice ;
>  into cursor crsPass2 ;
>ORDER BY mytable.price DESC
>
>select * from ;
>  crsPass1 ;
>  UNION ;
>  select * from crsPass2 ;
>INTO CURSOR curPrice
Cetin


Hi Cetin.
I have already done like this.I believed, that it is possible to make operation in one SELECT. Probably so it is impossible.
Thanks again.
Denis.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform