Home » SQL & PL/SQL » SQL & PL/SQL » Query Help... need some ideas
Query Help... need some ideas [message #212266] Thu, 04 January 2007 07:51 Go to next message
fmrock
Messages: 45
Registered: December 2006
Member
Hey everyone.

I am trying to fix a report that was created by a coworker and the higher ups want it arranged differently.

Basicly, the report lists accounts, there payment dates, and statment dates.

3 tables for example
tblAccount
tblPayments
tblStatements

You link the tables together with StoreID and AccountNumber.

They basicly want certian accounts and want a list of there statement dates and payment dates.

The old report another coworker made, had lots of lines for each account. So if there was 3 statements, and 4 payments, then 12 lines for each account would be on the report.

Any ideas how to make this for one line each?

Thanks for any help you can give.
Re: Query Help... need some ideas [message #212296 is a reply to message #212266] Thu, 04 January 2007 10:28 Go to previous messageGo to next message
fmrock
Messages: 45
Registered: December 2006
Member
Would this be something better suited for the expert forum?

I am stumped on trying to do this so any direction or advice would be great.
Re: Query Help... need some ideas [message #212300 is a reply to message #212296] Thu, 04 January 2007 10:52 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
If I understand you well, you want to combine multiple records into one. This is called a pivot.
There are quite some examples for pivot queries on both this board and the net, depending on what exactly your needs are. Maybe you can check those and come back with whether or not this suits your needs.
Re: Query Help... need some ideas [message #212332 is a reply to message #212266] Thu, 04 January 2007 14:13 Go to previous message
fmrock
Messages: 45
Registered: December 2006
Member
Thanks for the reply Frank.

I saw the pivot posts but the problem i was having with trying to do those is some accounts had 30-40 statments. Where others only had 1 or 2. It seemed that in creating a pivot query, you had to name your columns before hand.

I was able to use crystal reports and and some VB logic to create columns that had all of the dates in a string.

Thanks for you help.
Previous Topic: SUBQUERY QUESTION
Next Topic: Can I define Date Format in Create Table Syntax (merged)
Goto Forum:
  


Current Time: Fri Dec 02 22:51:54 CST 2016

Total time taken to generate the page: 0.08635 seconds