1052: Column 'id' in field list is ambiguous

前端 未结 8 1873
面向向阳花
面向向阳花 2020-11-22 13:17

I have 2 tables. tbl_names and tbl_section which has both the id field in them. How do I go about selecting the id field,

8条回答
  •  长发绾君心
    2020-11-22 13:57

    Already there are lots of answers to your question, You can do it like this also. You can give your table an alias name and use that in the select query like this:

    SELECT a.id, b.id, name, section
    FROM tbl_names as a 
    LEFT JOIN tbl_section as b ON a.id = b.id;
    

提交回复
热议问题