The TOP clause requires ORDER BY clause. In UNION ORDER BY clause can only be applied to the query result not to an individual SELECT. You can use derived table to get around this limitation.
SELECT lm_lotnum FROM it!lottmplt ;
UNION ;
SELECT * FROM ( ;
SELECT TOP 1 lm_lotnum ;
FROM it!lotmast ;
ORDER BY 1 DESC ) dt1 ;
INTO CURSOR results
>
>When I run the second SELECT I have no problem, but when I run it UNIONed with the first I get an error 'Command is missing required clause'
>
>What am I doing wrong?
>
>Thanx -
>
>Yossi
>
>
>SELECT lm_lotnum FROM it!lottmplt ;
> UNION ;
> SELECT TOP 1 lm_lotnum ;
> FROM it!lotmast ;
> ORDER BY 1 DESC ;
> INTO CURSOR results
>
--sb--