Nested query in a select statement, can it be done in MySql?
I have a table that shows a list of items ordered, however the item name is stored in column fp1, fp2 ...etc. Column Fp1q, fp2q....etc stores the quantilty.
What i want to do is use item name (Apples) in place of the column name i.e. fp1q
This does not work:
Select fp1q as (SELECT fp1 from gift_shop.orders) , fp2q, fp3q
Any help would be very much appreciated.
Fp1 is always the same value, but I don't want to hard code it in case it changes.