Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One SQL, two SQLs, three SQLs, four...
Message
From
21/01/2003 17:21:19
Mike Yearwood
Toronto, Ontario, Canada
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00744004
Message ID:
00744021
Views:
12
Hi Fred

I really must have two consecutive SQLs as I need MaxField in the final output. Your answer was right, since I asked the wrong question! The second SQL should have been ...
select cursor1.pkfield,cursor1.maxfield,table1.anotherfield from cursor1 inner join table1 on table1.pkfield = cursor1.pkfield into cursor cursor2
>>Hi All
>>
>>I can easily do this in VFP
>>
>>
SELECT <pkfield>,max(field2) as maxfield from <table1> group by <pkfield> into cursor <cursor1>
>>
>>and then...
>>
>>
SELECT <field1> from <table1> where <pkfield> in (select <pkfield> from <cursor1>) into cursor <cursor2>
>>
>>Question is, how can I do this with SQL Server? I'm assuming I won't be able to create a stored procedure on the client's database.
>>
>>Thanks in advance!
>
>>
SELECT <field1> from <table1> where <pkfield> in (select <pkfield> from (SELECT <pkfield>,max(field2) as maxfield from <table1> group by <pkfield>))
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform