SQL Joining query using Selection Statement

前端 未结 2 833
谎友^
谎友^ 2021-01-24 05:50

I have one table of oc_category_description where columns are :

  • category_id
  • name

and other table oc_category where columns are :

2条回答
  •  無奈伤痛
    2021-01-24 06:08

    Try this below script-

    SELECT oc_category.category_id, 
    oc_category.image, 
    oc_category.parent_id, 
    oc_category_description.name
    FROM oc_category 
    INNER JOIN oc_category_description 
        ON oc_category.category_id = oc_category_description.category_id
    WHERE oc_category.parent_id = 0 
    ORDER BY oc_category.category_id ASC
    

提交回复
热议问题