Information générale
Catégorie:
Codage, syntaxe et commandes
Kak dela, Denis?
I think you have two problems here.
Firstly, you can't use mytable.price in the order by when you use a union, you have to use the column number.
Secondly, the TOP n clause has to be in the first select only, but afflicts the result of the complete union (as does the ORDER BY).
One simple solution is to split your union into two intermediate cursors and do a third query to combine the result.
Arne
>I want to receive 2 records from the table between which the variable is located.
>
>My code:
>SELECT TOP 1 * ;
>FROM myDatabase!myTable ;
> WHERE myTable.cod = pCod ;
> AND myTable.price >=pPrice ;
> UNION ;
> SELECT TOP 1 *;
> FROM myDatabase!myTable;
> WHERE myTable.cod = pCod ;
> AND myTable.price <=pPrice ;
>ORDER BY mytable.price ;
>INTO CURSOR curPrice
>
>I receive error message... What the problem ?... OR I do't use TOP 1 AND UNION ?
>Thanks for your messages.
>Denis.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement