Having a problem in database selection mysql

落爺英雄遲暮 提交于 2021-02-20 04:51:29

问题


I have this table table chats and tbl_suggested. On table chats i have

  id       questions         answer            date
  1        What is life                        2020-02-08   
  2        what is PC      personal computer   2020-02-08
  3        What is life uk   good              2020-02-08
  4        where is the cr   there             2020-02-08

On the tbl_suggest i have this

      id       chats_id      questions                      
      1            1          What is life in spain         
      2            1         what is liefe in uk               
      3            1          What is life  in paris   

I query this code

SELECT chats.id,chats.question,chats.answer,tbl_suggest.questions,chats.date 
from chats LEFT JOIN tbl_suggest on chats.id= tbl_suggest.chats_id O
RDER by chats.date ASC

result is, then i want to remove that two what is life question on the second and third row

chat.id chat.questions    chat.answer     tbl_suggest.question     chats.date
  1      what is life                     what is life in spain       2020-02-08
  1      what is life                     what is liefe in uk         2020-02-08
  1      what is life                     what is life in paris       2020-02-08
  2      what is PC       personal computer                           2020-02-08       
  3       What is life uk  good                                        2020-02-08
  4      where is the cr   there                                      2020-02-08

I want is to remove the what is life redudant like this

   chat.questions        chat.answer     tbl_suggest.question       chats.date
   what is life                          what is life in spain       2020-02-08
                                          what is liefe in uk         2020-02-08
                                         what is life in paris       2020-02-08
   what is PC          personal computer                             2020-02-08       
   What is life uk      good                                         2020-02-08
   where is the cr       there                                      2020-02-08

to show it properly in my dialog box

来源:https://stackoverflow.com/questions/60128664/having-a-problem-in-database-selection-mysql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!