Subject RE: [firebird-support] Re: Multiply CASE in SQL statement
Author Thomas Clarke
I just took the liberty to re-format the SQL to help make it clearer.

SELECT
CASE A.Group
WHEN 1 THEN A.Price
WHEN 2 THEN C.Price
WHEN 3 THEN A.Price * P.Param_price
END as Price
FROM Article
JOIN Catalog C ON C.Article = A.id
JOIN Param P ON P.Date=A.Date
WHERE Id = :ID

Thomas Clarke.

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Dimitry Sibiryakov
Sent: Thursday, May 11, 2006 5:44 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Re: Multiply CASE in SQL statement

On 11 May 2006 at 7:39, majstoru wrote:

>Thanks for your reply, but can you please write an SQL how to solve
>this, I'm very poor with CASE into SQL statement?

SELECT CASE A.Group WHEN 1 THEN A.Price WHEN 2 THEN C.Price WHEN 3 THEN
A.Price * P.Param_price END as Price FROM Article JOIN Catalog C ON
C.Article = A.id JOIN Param P ON P.Date=A.Date WHERE Id = :ID

--
SY, Dimitry Sibiryakov.




------------------------ Yahoo! Groups Sponsor --------------------~--> You
can search right from your browser? It's easy and it's free. See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/67folB/TM
--------------------------------------------------------------------~->

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item on the
main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links