> -----Original Message-----
> From: henry_interiano [mailto:[EMAIL PROTECTED]
> Sent: Montag, 24. M�rz 2003 18:19
> To: [EMAIL PROTECTED]
> Subject: SQL Case
>
>
> As I make the following SQL in Sapdb. of this form it is made in
> SQLSERVER
>
> Select Raza.Nombre_Raza,
> Animal.Codigo_Sexo,
> Animal.Numero_Lote_Ceba,
> Animal.Codigo_Destino_Inicial,
> Count( Raza.Nombre_Raza ) As Animxlote,
> Case Animal.Codigo_Destino_Inicial
> When 1 Then Sum(1)
> End As Seleccionados,
> Case Animal.Codigo_Destino_Inicial
> When 2 Then Sum(1)
> End As Matadero
> From Camada
> Inner Join Raza
> On Camada.Codigo_Raza = Raza.Codigo_Raza
> Inner Join Animal
> On Camada.Codigo_Camada = Animal.Codigo_Camada
> Where Animal.Codigo_Destino_Inicial <> 0
> Group By Raza.Nombre_Raza, Animal.Codigo_Sexo,
> Animal.Numero_Lote_Ceba, Animal.Codigo_Destino_Inicial
> Order By Raza.Nombre_Raza, Animal.Numero_Lote_Ceba
Please use the function DECODE or CASE as written last October
(and part of the 7.4-reference-manual):
Hi,
with the next version of SAP DB (7.3.0.29 / 7.4.3.10) the SQL-function
CASE as known from some other database systems is available:
as
<simple_case_function> ::=
CASE <check_expression>,
WHEN <search_expression> THEN <result_expression>
[...]
[ELSE <default_expression>])
END
<check_expression> | <search_expression> | <result_expression> | <default_expression>
::= <expression>
and as
<searched_case_function> ::=
CASE
WHEN <search_condition> THEN <result_expression>
[...]
[ELSE <default_expression>])
END
<result_expression> ::= <expression>
<default_expression> ::= <expression>
Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general