SQL语句问题3个问题,求教?????
请教各位:
1.在pl/sql中有代码美化器,在Sql Server中有么?
2.写了一个查询语句查询表A,然后在表A中加了一个字段,但是那个查询语句中无法立刻查到新加的字段,重开Sql Server后才能查到,求解为什么?
3.在Oracle中一个数据集可以用括号括起来,空格指定别名,在Sql Server中如何做多,如下面语句
A那边报错:
SQL?Server
select b.oid, userInfo+' 预定'+b.mealCount+'份',b.insertTime,b.getTime,s.suppName,
b.bookReason, case b.isEnter when '0' then '否' when '1' then '是' end isEnter,
case b.isBack when '0' then '否' when '1' then '是' end isBack
from BookMealRecord b
left join (select d.departmentName+'——'+u.userName,u.userId userInfo
from UserInfo U
left join Department d
on u.userInDepartmentId=d.departmentId) A on b.userId=A.userInfo
left join SupplierInfo s on s.suppId=b.SupplyId
SELECT b.oid ,
a.userInfo + ' 预定' + b.mealCount + '份' ,
b.insertTime ,
b.getTime ,
s.suppName ,
b.bookReason ,
CASE b.isEnter
WHEN '0' THEN '否'
WHEN '1' THEN '是'
END isEnter ,
CASE b.isBack
WHEN '0' THEN '否'
WHEN '1' THEN '是'
END isBack
FROM BookMealRecord b
LEFT JOIN ( SELECT (d.departmentName + '——' + u.userName) AS duName ,--指定别名duName
u.userId userInfo
FROM UserInfo U
LEFT JOIN Department d
ON u.userInDepartmentId = d.departmentId
) A ON b.userId = A.userInfo
LEFT JOIN SupplierInfo s
ON s.suppId = b.SupplyId