首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求解释上面的sql语句

2012-10-13 
求解释下面的sql语句select t.*,t.c_fundcode||-||t1.c_fundname c_fundnamefrom tsplitschema t,tfundi

求解释下面的sql语句
select t.*,t.c_fundcode||'-'||t1.c_fundname c_fundname from tsplitschema t,tfundinfo t1 where 1=1 and t.c_fundcode=t1.c_fundcode and t.c_dealflag='0'

[解决办法]
1 = 1 在拼凑字符串的时候用 ,后面的句子可以固定用 where 1 = 1 and 条件1 and 条件2 and 。。。
如果没有 1 = 1 没有条件时就会变成 select * from tb where --报错
 有条件时 select * from tb where and 条件1 --报错
当然这两种情况都可以处理,最方便就是加 1 = 1

热点排行
Bad Request.