我想在另一个表格中显示另外一个列数据" tbl_link
",
SELECT K.KeyWord,
kp.KeywordId,
kp.CurrentPosition,
CONVERT(VARCHAR(2), Psnupdatedate, 106) shortdate,
CONVERT(VARCHAR(12), Psnupdatedate, 106) AS FullDate,
categoryid
FROM seo.Tbl_KeywordPosition kp
LEFT JOIN Tbl_ProjAssignment pa
ON pa.ProjId = kp.ProjectId
AND pa.KeywordID = kp.keywordId
LEFT JOIN Tbl_link l
ON l.KeywordID = kp.keywordId
LEFT JOIN Tbl_keywords k
ON k.KeywordID = kp.keywordId
WHERE ProjectId = '109'
AND pa.username = 'gangabhavani'
AND kp.KeywordID = '1467'
AND CONVERT(CHAR(4), PsnUpdateDate, 100) = 'Jan'
AND CONVERT(CHAR(4), PsnUpdateDate, 112) = '2015'
ORDER BY KeyWord,
FullDate ASC
当前输出:
keyword keywordid keywordposition shortdate FULLDATE categoryid
homeopathy clinics 1467 16 21 21 Jan 2015 NULL
homeopathy clinics 1467 8 22 22 Jan 2015 NULL
homeopathy clinics 1467 11 23 23 Jan 2015 NULL
预期结果
keyword keywordid keywordposition shortdate FullDate CategoryId
homeopathy clinics in Hyderabad 1467 16 21 21 Jan 2015 ?
homeopathy clinics in Hyderabad 1467 8 22 22 Jan 2015 ?
homeopathy clinics in Hyderabad 1467 11 23 23 Jan 2015 ?
如何制作加入和展示类别
category
表包含这些列
LinkId | LinkName | CategoryId | KeywordID | ProjectId
如果我将1=1
加入tbl_link
加入所有活动?