Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to normalize my list
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Trying to normalize my list
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01151443
Message ID:
01151443
Views:
79
Hello All,

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!
Randy Bosma
VFP - Because life is too short to code in something else...
Next
Reply
Map
View

Click here to load this message in the networking platform