Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'Case' question
Message
De
03/04/2007 03:23:13
 
 
À
02/04/2007 17:03:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01211479
Message ID:
01211579
Vues:
17
Hi Carlos,

I think you've missed to name the column after your CASE...END statement also I think that you don't need the IS NULL statement after the SUM() command because SUM can only result in NULL if amount is null.
BTW: SUM() does require a GROUP BY and HAVING can only use 'real' tables from the original table (table1 here).


A possible attempt:
SELECT table1.loanumber, CASE WHEN table1.amount IS NULL THEN 0 ELSE SUM(table1.amount) END AS CUOTA 
FROM table1 WHERE table1.amount > 0 GROUP BY table1.loanumber, table1.amount
HTH

>Hi friends. I have the following group of command in SQL:
>
>SELECT table1.loanumber, 'CUOTA' =
> CASE
> WHEN sum(table1.amount) is null then 0
> ELSE table1.amount
> END
>FROM table1
>where table1.amount > 0
>having CUOTA >0
>GO
>
>
>But, it send an error message : Invalid colun name 'CUOTA'
>Really I have more command lines in this group but this is the central idea.
>What can I do?...
>Thanks in advance.
>
>Carlos Burgos
robert.oh.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform