Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL to get the alphabetical next
Message
De
31/03/2003 12:16:31
 
 
À
31/03/2003 09:50:46
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00771820
Message ID:
00772057
Vues:
8
I forgot to add the Order By clause

ORDER BY lastname, firstname, custid

-Mike

>Dear Michael,
>
>Thank you for your response. However I am afraid the command may not be able to return the correct record since the following customer will not satisfy the WHERE condition of the SQL even if it is actually the alphabetical next.
>CustID=73, LastName='Barret', FirstName='Amy'
>
>KM
>
>
>>Since you can have duplication with both the first and last name, can you include the custID as part of the sequencing:
>>
>>SELECT TOP 1 *
>>FROM yourTable
>>WHERE LastName >= @lastName
>> AND FirstName >= @firstName
>> AND custID > @custID
>>
>>-Mike
>>
>>>The customer table of my SQL server database contains the following 3 column. There may be more than one customer having exactly the same last and first names while CustID is unique:
>>>CustID, LastName, FirstName
>>>
>>>Data currently showing in my "Customer Data" form are
>>>CustID=671
>>>LastName='Barnes'
>>>FirstName='John'
>>>
>>>What is the best SQL command to get the CustID of next (alphabetic order) customer?
>>>
>>>Grateful if anybody can help.
>>>KM
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform