Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subqueries in select list of FoxPro SQL
Message
From
03/10/2001 11:28:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/10/2001 09:47:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00563561
Message ID:
00563647
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
>SQL Server likes this query, but FoxPro doesn't. Foxpro gives
>
>Function name is missing ).
>
>Anybody know how to reword it to work?
>
>select rtrim(clients.fname)+rtrim(' '+clients.mname)+' '+rtrim(clients.lname) as fullname, (select top 1 plans.effective from plans where plans.clientno=clients.clientno and plans.effective>date() order by plans.effective) as meetdate, (select top 1 plans.meet_time from plans where plans.clientno=clients.clientno and plans.effective>date() order by plans.effective) as meettime from clients into table formlet2 order by clients.lname, clients.fname, clients.mname, clients.clientno

Randy,
This would work with SQL server, however are you sure it's correct ? To me it sounds like this would fail if target date had more than one meettime ?

Apart from that below might be sample to formulate VFP counterpart :
create cursor myGrouper (Ino i, ddate d, irec i)
for ix = 1 to 20
  insert into myGrouper ;
	values (int(rand()*5), date()-int(rand()*100), ix)
endfor
select * from myGrouper order by 1,2

select * from myGrouper A where ddate = ;
(select max(ddate) from myGrouper B where a.ino = b.ino) ;
order by ino
What it does is to pull out last date rows per ino (dates are enetered in random order).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform