Toad World® Forums

Multiple Rows need the date in multiple columns

Hi All,

When I run my query in toad I get the results in multiple rows, can anyone tell me the code on how to get this into multiply columns.

i.e.

ID Name Account Amount
1 test Acc 1 1500
1 test Acc 2 500
1 test Acc 3 450
2 test 2 Acc 1 300
2 test 2 Acc3 500

I want it to display as follows:

ID Name Acc1 Acc2 Acc3
1 test 1500 500 450
2 test 2 300 500

Thanks

Hi Una,

Can you please share your SQL query?

If I understand you correctly, a pivot query should do it. Pivot on account, by the looks of what you are trying to do.

J Fischer