>>I need to create a query with columns containing quarterly figures. I figured I could handle that with subqueries, but I am trying to make this work for a long time already and it still does not seem right.
>>The final result now gives the correct figures, but I cannot add the last quarter to it because of the join with the GL accounts, if there is no result in the subquery, it drops the entire line.
>>I must be doing something wrong, but I can't figure out how to correct it.
>
>I agree with Sergey - this is the kind of query where PIVOT will very likely help you.
>
>If you've never used PIVOT before, I'll be glad to help - if you'll post the DDL/Table structure for the tables involved. Don't need any data - just the table structures.
Thanks both of you, I realize that now. Never have used pivot before but seems to be straightforward. I now use datepart(quarter) in the query and can ise that for the pivot.
Christian Isberner
Software Consultant