在期望条件的上下文中指定的非布尔类型的表达式 - 错误

时间:2012-10-17 14:43:04

标签: sql sql-server

希望有人可以给我一些指导。我的问题:

SELECT
    wm.ID,
    wm.name,
    wm.meeting_type,
    m.start_date,
    wml.name as location
FROM
    webmaster.meeting wm inner join meetings m on wm.ID = m.Meeting_Code
    inner join webmaster.meeting_location on wml wm.locationID = wml.ID
WHERE
    Year(m.start_date) = Year(getDate())
ORDER BY
    m.start_date

运行时,我收到此错误:

Msg 4145, Level 15, State 1, Line 9
An expression of non-boolean type specified in a context where a condition is expected, near 'wm'.

我有什么遗失的吗?

2 个答案:

答案 0 :(得分:5)

更改此内容
inner join webmaster.meeting_location on wml wm.locationID = wml.ID

to 

inner join webmaster.meeting_location wml on wm.locationID = wml.ID

答案 1 :(得分:0)

试试这个:

SELECT
    wm.ID,
    wm.name,
    wm.meeting_type,
    m.start_date,
    wml.name as location
FROM
    webmaster.meeting wm inner join meetings m on wm.ID = m.Meeting_Code
    inner join webmaster.meeting_location wml on wm.locationID = wml.ID
WHERE
    Year(m.start_date) = Year(getDate())
ORDER BY
    m.start_date