tags:

views:

34

answers:

1

I have a table called problemTBL, which contains the fields below

problem_id Autoincrement,Pk
passenger_id, accept duplicate values
problem_name, problem description 

These are sample records:

Problem_id passenger_id    problem_name
1              22         NO Air condition 
2              22         Dirty Seats
3              24         Driver Not helped
4              22         Old Age Car
5              23         Old Age Driver
6              22         Very speed driving

Now I want to retrieve a record like

["NO Air condition","Dirty Seats","Old Age Car","Very speed driving","","","","","","","","","","",""] passenger_id 22

["Driver Not helped","","","","","","","","","","","","","",""] passenger_id 24

OR

passenger_id    problem_name
22              NO Air condition |=| Dirty Seats |=| Very speed driving |=|Old Age Car
24              Driver Not helped
23              Old Age Driver

Is it possible with a query?

Hi the thing , am doing migration ,

at present i kept all the problem in each now, now i am doing migration , i want to keep all problem for the particular customer into one single row,

That is one customer can raise compliant upto 15 only(For complaint we have seprate form , there we asking some questions, they just tick and submit..)

So we have decided clearly that is only 15 problem ,

So one row for one customer,

That is now latest compliant form have 15 complaint , if they selected , then that problem will check else empty val will be insert ,

While submiting the form am just post all values into json_encoded and then am insert this json into table...

Got it my point...

For future complaint i done program well,

But past compliants i want to migrate , so that i posted question here,.,,

A: 

read about cross-tabulations (aka pivot tables) here:

http://onlamp.com/pub/a/onlamp/2003/12/04/crosstabs.html

stillstanding