Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subqueries in select list of FoxPro SQL
Message
From
03/10/2001 10:47:04
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00563561
Message ID:
00563609
Views:
16
Thanks for the input Larry. It dawned on me later that I could cook up a workable solution with two queries thusly:

select min(plans.effective) as effective,plans.clientno from plans group by plans.clientno into table nextplan

select rtrim(clients.fname)+rtrim(' '+clients.mname)+' '+rtrim(clients.lname) as fullname, plans.effective, plans.meet_time from clients left outer join nextplan on clients.clientno=nextplan.clientno left outer join plans on clients.clientno=plans.clientno and plans.effective=nextplan.effective

This relies on not having two plans effective the same day. If this couldn't be relied upon, we would need a query in the middle to get the min(plans.meet_time) for each plans.effective.

select min(plans.meet_time) as meet_time, nextplan.effective ,nextplan.clientno from plans join nextplan on nextplan.clientno=plans.clientno and plans.effective=nextplan.effective group by plans.effective, plans.clientno into table nextplan2
Randy Hersom
President, Habilitation Software Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform