Ninjatalon
Ninjatalon

Reputation: 93

Combining several rows into one with no relation key

Hey guys I'm kind of stuck here. I have a table that I need to combine several rows together.

The reason I need to combine several rows is because of the format my Crystal Reports will show this information. Thanks in advance.

My DB:

ID     Review              Date
------------------------------
2      2nd Review        9/1/2011
3      1st Review        3/6/2012
5      1st Review        2/12/2010
6      1st Review        6/12/2012
7      3rd Review        6/21/2011

My query should only output dates from 8/1/2011 or greater. My outcome should come out like this:

Review1            Date       Review2            Date        Review3            Date
------------------------------------------------------------------------------------
1st Review         6/12/2012   1st Review        3/6/2012     2nd Review       9/1/2011

Upvotes: 1

Views: 92

Answers (1)

Arnoud
Arnoud

Reputation: 36

PostgreSQL person myself, but you could use the GROUP_CONCAT function to concatenate all the reviews and dates. It would probably mean you will have to perform some parsing on the Crystal side to make it look nicer/cleaner, but it should get everything onto one row for you.

Upvotes: 1

Related Questions