Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT with CASE
Message
 
 
À
21/02/2005 17:53:33
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00989053
Message ID:
00989056
Vues:
17
I'm surprised that you get any result at all because there's no tables with aliases "b" and "d" in the FROM clause. It's better to use two or more letter meanigfull aliases instead of a,b,c,d, e.t.c which make the query unreadable.

>
>I have this SELECT Statement,
>
>SELECT distinct c_cod_art, c.c_descri, b.c_nome,
>SUM (CASE WHEN d.n_ent_sai =  1 THEN n_quant_1 ELSE 0 END)  as ENT,
>SUM (CASE WHEN d.n_ent_sai =  2 THEN n_quant_1 ELSE 0 END)  as SAI
>from tbl_gc_movimentosstk a
>left join tbl_gc_Artigos c on c.c_codigo=a.c_cod_art
>group by c_cod_art, c.c_descri, b.c_nome
>order by c_cod_art
>
>
>and it gives two rows for the same c_cod_art, one for ENT, and one for SAI, any chance to join them only in one row.
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform