my sql与sql sever怎么转化
String sQuery = "select course.limited,IF(elective.course_id, count(*), 0) as amount "
+ "from course left join elective "
+ "on course.course_id = elective.course_id "
+ "where course.course_id = '" + sCourseId + "' "
+ "group by course.course_id";
什么意思,是什么语句啊,怎么用sql sever写????
[解决办法]
declare @sCourseId int
set @sCourseId=100 -->这是变量,外部传进来的
select course.limited, count(elective.course_id) as amount
from course
left join elective on course.course_id = elective.course_id
where course.course_id = @sCourseId
group by course.course_id