i have Two Table Inquiry Table and Inquiry Quotation Table i Upload The Data in To inquiry Table and send To multiple supplier and They Put Their Prices in Inquiry Quotation Table i am Getting The Data in row vs with supplier and supplier data as Shown in Inquiry Quotation But i want To show The Supplier Name and its data in column vs Please Help me. Thanks
Asked
Active
Viewed 428 times
0
-
This is a "pivot". You *can* do this in mysql, but I think it's much simpler and generally more flexible/scalable to do this in the presentation layer/application-level code, assuming you have that (e.g. a simple PHP loop acting upon an ordered array) – Strawberry Mar 30 '14 at 08:00
2 Answers
0
-
Thanks Imran for response i tried using for loop and while loop but i not get the answer is it possible that you also write a code? – khan Mar 30 '14 at 08:42
0
I have created a basic structure of your table and tested on it. Something like:
SELECT ET.enq_detail_id,ET.enq_id,EQ1.s_id, EQ1.enq_detail_id, EQ1.weight_per1000 , EQ2.s_id as s_id_2, EQ2.enq_detail_id as enq_detail_id_2, EQ2.weight_per1000 as weight_per1000_2
FROM EnqueryTable ET LEFT OUTER JOIN
EnqueryQuoted EQ1 ON EQ1.enq_detail_id=ET.enq_detail_id LEFT OUTER JOIN
EnqueryQuoted EQ2 ON EQ2.enq_detail_id=ET.enq_detail_id
WHERE EQ1.s_id=2 AND EQ2.s_id=4
Result is:
ENQ_DETAIL_ID ENQ_ID S_ID WEIGHT_PER1000 S_ID_2 ENQ_DETAIL_ID_2 WEIGHT_PER1000_2
157 19 2 10 4 157 10.4
158 19 2 157 4 158 157
159 19 2 22 4 159 22.5
See result in SQL Fiddle.
Now add the required column names in this query.

Raging Bull
- 18,593
- 13
- 50
- 55