select UserProperty.PropertyName,UserProperty.UserClassID,UserProperty.PropertyType,UserPropertyValue.* from UserProperty left join UserPropertyValue on UserProperty.UserClassID in (1,2,3) and UserProperty.PropertyID=UserPropertyValue.PropertyID and UserPropertyValue.UserID='wujiabin'
select UserProperty.PropertyName,UserProperty.UserClassID,UserProperty.PropertyType
from
UserProperty.UserClassID*=UserPropertyValue.UserClassID and --不知道是否以
--UserClassID为连接字段?
UserProperty.UserClassID=1 and UserProperty.PropertyID=UserPropertyValue.PropertyID and UserPropertyValue.UserID='wujiabin'
我的意思的
我的 sql语句 与
你写的sql,得到的结里是一样的呀
应该不同呀
select UserProperty.PropertyName,UserProperty.UserClassID,UserProperty.PropertyType
from
UserProperty.PropertyID*=UserPropertyValue.PropertyID and
UserProperty.UserClassID=1 and
UserPropertyValue.UserID='wujiabin'
要显示UserProperty.UserClassID=2或3,还是不要?
要就要去掉条件:
UserProperty.UserClassID=1
的记录
但
是结果 UserProperty.UserClassID=2 or 3 的记录来出来的这条件好像没有起作用呀
你再检查一下,ID不是数字就加个''号试试
UserProperty.PropertyName,UserProperty.UserClassID,UserProperty.PropertyType
from UserProperty,UserPropertyValue
where UserProperty.PropertyID*=UserPropertyValue.PropertyID and
UserProperty.UserClassID=1 and
UserPropertyValue.UserID='wujiabin'
的*号是什么意思呀。
UserProperty.PropertyType,
UserPropertyValue.*
from UserProperty left join UserPropertyValue
on UserProperty.PropertyID=UserPropertyValue.PropertyID
where UserProperty.UserClassID=1
and UserPropertyValue.UserID='wujiabin'
这个语句 不灵,结果不对呀.select UserProperty.PropertyName,UserProperty.UserClassID,
UserProperty.PropertyType,
UserPropertyValue.*
from UserProperty left join UserPropertyValue
on UserProperty.PropertyID=UserPropertyValue.PropertyID
where UserProperty.UserClassID=1
and UserPropertyValue.UserID='wujiabin'