Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Do you see why projection doesn't work here?
Message
De
25/06/2008 13:08:54
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01326684
Message ID:
01326686
Vues:
20
>Hi everybody,
>
>I have a complex (and wrong) select statement that I tried yesterday at home (where I have an empty database with the same structure) and this query produced an error.
>
>SELECT P.PersonID, P.FirstName, P.MiddleName, P.LastName, P.Gender,
>P.DOB,
>( select top 1  Address1 from people where personid=P.father ) as FAddress ,
>  ( select top 1  Address1 from people where personid=P.mother ) as MAddress ,
>(select  case ( select top 1  CellPhone from people where personid=P.father) when '' then '-' else
>( select top 1  CellPhone from people where personid=P.father) end) as FCellPhone ,
>(select case ( select top 1 CellPhone from people where personid=P.mother ) when ''
>then '-' else ( select top 1 CellPhone from people where personid=P.mother ) end) as MCellPhone
, etc.
>
>I tried this select again here and it worked just fine.
>
>The only difference that I don't have data at home.
>
>In any case, the select statement is wrong, so I would be changing it... But just curiosity sake why didn't it work without data?
>
>Thanks again.


And the error is?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform