Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is wrong with this SQL Select?
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01424146
Message ID:
01424297
Vues:
26
Thank you.

>Basically, yes.
>
>>I was wondering, if there are two rows/records that have the same value in ORDERNO field/column, how does SQL Server select one in the expression MIN(ORDERNO)? Is it random?
>>
>>
>>>Try
>>>
>>>TEXT TO cSqlCommand  NOSHOW
>>>select C1.*, C2.LASTNAME, C2.FIRSTNAME, C2.TELEPHONE1 
>>>	from COMPANY C1 
>>>		LEFT JOIN (SELECT LASTNAME, FIRSTNAME, TELEPHONE1, COMP_PK FROM PEOPLE p3	
>>>       WHERE ORDERNO = (SELECT MIN(ORDERNO) FROM PEOPLE p4 where p3.comp_pk =p4.comp_pk )) C2 ON C1.COMP_PK  = C2.COMP_PK
>>>ENDTEXT
>>>
>>>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform