Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with totalize per quarter
Message
 
 
À
19/08/2016 17:52:36
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
OS:
Windows 10
Network:
Windows Server 2012
Divers
Thread ID:
01639700
Message ID:
01639706
Vues:
58
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform