Subject Re: [firebird-support] Re: Data in Row Format, Need To Display In Columun Format
Author Vishal Tiwari
Hi Dear SET (A Real Master-Trouble Shooter),

Thank You once again SET, I was unknown to WITH in sql.
Now I got the over all idea, I would try with your sql and would get back to you in all the cases.
A Heartful Thank you And With Best Regards.

--- On Wed, 8/9/10, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:

From: Svein Erling Tysvær <svein.erling.tysvaer@...>
Subject: [firebird-support] Re: Data in Row Format, Need To Display In Columun Format
To: "''" <>
Date: Wednesday, 8 September, 2010, 2:22 PM


>Hi SET,

>Sorry it might be because I am not good enough with sql, asking you last doubt that do I need to use your entire sql as it i.e. WITH and next SELET is

>WITH Branches(BranchCode) as
>FROM Book_Details
>WHERE (sYearMonth = :YearMonthA or sYearMonth = :YearMonthB)
>AND BookName in(:MyFirstBookName, :MySecondBookName)
>SELECT B.BranchCode, BD1A.rBook_Price as Book1PriceYearMonthA, BD1B.rBook_Price as Book1PriceYearMonthB,
>coalesce(BD1A.iCopy_Sold, 0) - coalesce(BD1B.iCopy_Sold, 0) as Book1CopySoldDifference,
>coalesce(BD1A.Tot_Amount, 0) - coalesce(BD1B.Tot_Amount, 0),
>BD2A.rBook_Price, BD2B.rBook_Price, coalesce(BD2A.iCopy_Sold, 0) -
>coalesce(BD2B.iCopy_Sold, 0),

Hi again Vishal!

If I understand this question correctly, then the answer is yes, you need both the WITH part (including SELECT) and the SELECT part. Think of the WITH as a way to create a temporary table that you can use in your main select.

As I said in my last reply, it is possible to avoid WITH in your query, but that would make the query more complex.


[Non-text portions of this message have been removed]