Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to normalize my list
Message
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
Database:
Visual FoxPro
Divers
Thread ID:
01151443
Message ID:
01151448
Vues:
29
This message has been marked as the solution to the initial question of the thread.
To unduplicate the list change UNION ALL to UNION. Also remove GROUP BY because it's unnecessary and only applies to the select statement it included in.

>
>For a client with very denormalized data structures (in an old application), I first wrote a simple SQL-Select to get a list of all the route numbers from the first of 5 route number columns:
>
>SELECT route_no FROM (ClientDataPath+'customer') ;
>	GROUP BY route_no  ORDER BY route_no ;
>INTO CURSOR RouteList
>
>All works well there. However, this does not:
>
>SELECT route_no AS routenum ;
>	FROM (ClientDataPath+'customer') ;
>	WHERE .NOT.EMPTY(route_no) ;
>UNION ALL ;
>SELECT route_no2 AS routenum ;
>	FROM (ClientDataPath+'customer') ;
>	WHERE .NOT.EMPTY(route_no2) ;
>UNION ALL ;
>SELECT route_no3 AS routenum ;
>	FROM (ClientDataPath+'customer') ;
>	WHERE .NOT.EMPTY(route_no3) ;
>UNION ALL ;
>SELECT rr_1 AS routenum ;
>	FROM (ClientDataPath+'customer') ;
>	WHERE .NOT.EMPTY(rr_1) ;
>UNION ALL ;
>SELECT rr_2 AS routenum ;
>	FROM (ClientDataPath+'customer') ;
>	WHERE .NOT.EMPTY(rr_2) ;
>GROUP BY routenum  ORDER BY routenum ;
>INTO CURSOR RouteList
>
>Assistance gratefully accepted - apparently I've done something wrong while UNIONing.
>
>Thanx!
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform