日期:2014-05-18  浏览次数:20457 次

两个简单的sql问题
看到sql中有where   1=1这样的语句,什么意思?

String   sQueryStr= "select   mv.personid,log.livInfo,log.retType,log.parInfo, "   +
    "log.health,log.PtMem   from   Social.socMv   mv   "   +
    "left   join   Social.socLogin   log   on   log.personid   =mv.personid   where   log.livComm=?   ";

这些mv.   log.   left   join   什么意思,又不是字段?

------解决方案--------------------
mv是Social.socMv的别名
log是Social.socLogin 的别名

where 1=1: 1=1是真,select * from 表名 where 1=1 查询得表中的所有数据,主要用于拼接查询数据串,