Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Order by in union
Message
De
22/03/2017 13:53:49
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01649254
Message ID:
01649256
Vues:
46
>Hi all,
>the code below works but I need to add in an order by field1, field2 but I can't get it to work, I get an order by error. I've tried a simple order by command but no joy, also tried moving between engine behaviour 70/80/90 with no luck. Any help appreciated.
>~M
>
>
>sele FIELD_LIST ;
>	from TBALE1 ;
>		join TABLE2 ;
>		join TABLE3 ;
>	where something ;
>		AND something else ;
>	UNION ;
>sele FIELD_LIST
>	from TBALE1 ;
>		join TABLE2 ;
>		join TABLE3 ;
>	where something ;
>		AND something else ;
>	into cursor temp2 nofilter
>
You query should be like this:
sele COLUMN_LIST ;
	from TBALE1 ;
		join TABLE2 ;
		join TABLE3 ;
	where something ;
		AND something else ;
	UNION ;
sele COLUMN_LIST
	from TBALE1 ;
		join TABLE2 ;
		join TABLE3 ;
	where something ;
		AND something else ;
	ORDER BY 2, 4, 1
	into cursor temp2 nofilter
The ORDER BY clause goes on the LAST SELECT. Where 2, 4, 1, are the order of the columns your whole query will be ordered by. In other words: ORDER BY column2, column4, column1.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform