当前位置: 代码迷 >> Sql Server >> 两个简单的sql有关问题
  详细解决方案

两个简单的sql有关问题

热度:62   发布时间:2016-04-27 16:47:52.0
两个简单的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 查询得表中的所有数据,主要用于拼接查询数据串,
  相关解决方案