Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About jjjcr

  • Rank

Profile Information

  • Gender
    Not Telling
  1. I really appreciate your reply: My table looks like this: | id | food_name | food_qty | 1 Chicken 3 Hotdog 4 -------------------------------- 2 Egg 1 Bun 1 Onions 3 So basically, 1 id has multiple lines on it I tried this: SELECT replace(replace(food_name, char(13), ' '), char(10), ' '), replace(replace(food_qty, char(13), ' '), char(10), ' '), CONCAT(food_name,' ',food_qty) as food_name_qty FROM foodx The reason I tried to replace the line feed because i was hoping that the concat would replace the new line and the values will be side by side but it's not. I also tried this: SELECT CONCAT_WS(' ',COALESCE(food_name,''),COALESCE(food_qty,'')) AS food_name_qty FROM foodx It doesn't work, also. I just want the output to display side by side. food_name_qty: Chicken - 3 ( the food name has the quantity on the same row) Hotdog - 4 Thanks, I really need your help. if this would not be possible, maybe i would just create a separate table with the pre-formatted string so i will I would have any problem for retrieval of data when it's exported to CSV.
  2. This is what i got from your answer: SELECT CONCAT(food_name, ' - ', food_qty) as food_name_qty from foodx Forgot to tell that in one row there is multiple lines. What i mean: id Food_Name Food_Qty 1 Chicken 3 Hotdog 5 so basically, id 1 has two lines Concat is good if one row has one line, but how to combine two columns if there are multiple lines? and combine them side by side. Thanks again.
  3. Hi Sen, thank you so much for you reply. I tried your solution but the output is like this: Chicken Hotdog - 3 5 It it possible to have it side by side?
  4. Hi guys, how do i join two columns as one column side by side? What I mean is like this: (columns in same table, table name as foodx) foodx --- Food_Name Food_Qty Chicken 3 Hotdog 5 ... .... rest of data continues Desired output: Food_Name_Qty Chicken - 3 Hotdog - 5 Thanks in advance for your help.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.