我是初學者,我需要幫助!!!!!來自4個表格的sql查詢
我有一個數據庫:
文章:
id, name, description, id_pic, lang, date
類別:
id_cat, name_cat
圖片:
id_pic, image
sub_cat:
id_subcat, name_subcat, id_cat
,我需要選擇name, desc, image, name_subcat
這對
SELECT
a.id, a.name, a.desc, sc.name_subcat, p.picture, a.id_subcat
FROM
article a, subcategory sc
LEFT JOIN
pictures p ON a.id_pic = p.id_pic
WHERE
a.id_subcat = sc.id_subcat
AND a.id_subcat IN (SELECT sc.id_subcat
FROM subcategory sc
WHERE id_cat = (SELECT id_cat
FROM category
WHERE name_cat = '???????'))
你在使用MSSQL 2008年,2005年MSSQL,MSSQL 2000或MySQL等? – Arion 2012-02-21 09:54:59
你在找什麼?什麼標準? – 2012-02-21 10:01:35