我正在尝试以下查询
`select
skillmgt.*, competences.Competence_Description
from skillmgt
inner join competences
on skillmgt.eid=competences.competence_id
where eid=121 and datename(yyyy,timestamp)=2013`
查询成功运行,但它没有返回任何结果,尽管eid's
等于某个competence_id's
且where
子句也为真
实际上,即使没有where
条款,它也不起作用!
编辑:通过执行以下解决方法:
select skillmgt.*,competences.* from competences
join skillmgt
on competences.competence_id=skillmgt.cid
where skillmgt.eid=121 and datename(yyyy,skillmgt.timestamp)='2013'
答案 0 :(得分:2)
datename
返回一个字符串。根据您的SQL风格,您应该尝试
select
skillmgt.*, competences.Competence_Description
from skillmgt
inner join competences
on skillmgt.eid=competences.competence_id
where eid=121 and datename(yyyy,timestamp)="2013"
答案 1 :(得分:0)
试试这段代码:
select
skillmgt.*, competences.Competence_Description
from skillmgt,competences
where skillmgt.eid = competences.competence_id
...