Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

SQL help-Period names on columns.

$
0
0
Hello to all. I need some help on SQL as I’m new to it. I have the following two tables:
AMOUNTS (a)
Account_ID
Period_name
Amount

ACCOUNTS (b)
Acount_ID

By using the following SQL query:
Code:

SELECT b.Account_ID , SUM(a.Amount), a.Period_name
FROM AMOUNTS a, ACCOUNTS b
WHERE a.Account_ID = b.Account_ID
GROUP by b.Account_ID,a.Period_name

I get
Account_ID SUM(Amount) Period_name
XXXXX XXXXX AAAAA
XXXXX XXXXX BBBBBB

How can I get?
Account_ID AAAAA BBBBB
XXXXXX XXXXX XXXXX

Thanks in advance for any kind help.
Octavio

Viewing all articles
Browse latest Browse all 13329

Trending Articles