Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GROUP BY clause ignored in VIEWS with UNION Clause
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01575879
Message ID:
01575890
Views:
50
>Rechecked my Data and found that TOP statement in the 2nd View will work correctly..

See the same result in my View, if I use a TOP 1 statement in the 2nd View. Is there anyway around this in a View Definition (outside of creating a Temporary Table)?
>
>>View definitions in VFP are independent of each other. If one view references another, the second view is executed and the result is used as if it were a table. Unless you include a GROUP BY in the second view, also, you wouldn't see grouped data. Keep in mind that a UNION contains an implicit DISTINCT operation which in turn does an implicit ORDER BY on every field. Compare the results of the following two queries to see what I mean:
>>
>>SELECT Type, id FROM SYS(2005)
>>SELECT Type, id FROM SYS(2005) UNION SELECT Type, id FROM SYS(2005)
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform