速给分 子查询
在线等速给分子查询因为用到了左连接我想在查询得到的结果多加个条件 coach“变量”[解决办法]试试这个:sel
在线等 速给分 子查询
因为用到了左连接 我想在查询得到的结果多加个条件 coach=“变量”
[解决办法]试试这个:
select sportman_waichu.*,now_unit,coach from sportman_waichu left join sportman on sportman.sp_ID=sportman_waichu.sp_ID
where coach='变量'
[解决办法]select?sportman_waichu.*,now_unit,coach?
from?sportman_waichu?left?join?sportman?on?sportman.sp_ID=sportman_waichu.sp_ID
WHERE coach='变量'
[解决办法]你这个要用动态SQL吧,你的变量的意思是传入的值吧
declare @var int
set @var = 123
declare @sql varchar(256)
set @sql = 'select sportman_waichu.*,now_unit,coach from sportman_waichu left join sportman on sportman.sp_ID=sportman_waichu.sp_ID where coach='+@var
exec(@sql)