mysql: value can be "null", but not must be "specific_value"
I have a query like this:
SELECT group.active, group.desc,
group.group_id, hide_group.hide,
hide_group.user_id
FROM group
LEFT JOIN hide_group ON
group.group_id=hide_group.group_id
WHERE group.active=1
AND hide_group.user_id != 'test'
OR hide_group.user_id IS NULL
ORDER BY hide_group`.`user_id` DESC
This completely ignores the active row for some reason? If I remove
and hide_group.user_id!='test'
It takes active=1 into account, but does not return right values. If I examine the first query, everything would be ok if the active condition w开发者_StackOverflow中文版ould be taken into account. Help!
Use the parentheses in the correct way when you deal with "and" and "or" together.
table name group, field name desc would not help
加载中,请稍侯......
精彩评论