Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select with Group by and Order by
Message
 
 
À
28/04/2010 09:56:32
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01462119
Message ID:
01462336
Vues:
36
>>This query is returning one record where either Master_IND = 'Y' or we don't have Master_ID = 'Y' so we grab any other record. It also gives us the count of records per Master_Code satisfying these requirements.
>
>Are you saying it works if you make a complex explanation to a complex SQL:) I mean how would you get a result using that query other than 1 for the reccount. You could instead simply say then:
>
>
select MAX(Master_Ind) as master_ind, Master_Code, 1 as reccount ;
>from myTable ;
>group by Master_Code
Cetin

No, I don't think it will return only 1 record as a count. If the original table has multiple Y records per Master_Code it is supposed to return the number of Y records and if it didn't have Y records, IMHO, it supposed to return number of N records.

I'm guessing, now I have to setup a quick test case - I'll do in SQL Server.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform