Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One SQL, two SQLs, three SQLs, four...
Message
De
21/01/2003 17:21:19
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
21/01/2003 17:04:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00744004
Message ID:
00744021
Vues:
13
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>))
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform