declare @a table (class_id int, xuesheng_id int)
insert @a
select 1, 1 union all
select 1, 2 union all
select 1, 3 union all
select 2, 1 union all
select 2, 2 union all
select 2, 3
declare @b table (class_id int, xuesheng_id int)
insert @b
select 1, 1 union all
select 2, 3
--方法1
select class_id, xuesheng_id from
(select a.*, b_class_id = b.class_id from @a a left join @b b on a.class_id = b.class_id and a.xuesheng_id = b.xuesheng_id) c
where b_class_id is null
--方法2
select * from @a where class_id * power(10, len(xuesheng_id)) + xuesheng_id not in (select class_id * power(10, len(xuesheng_id)) + xuesheng_id from @b)
--方法3
select * from @a where cast(class_id as varchar) + cast(xuesheng_id as varchar) not in (select cast(class_id as varchar) + cast(xuesheng_id as varchar) from @b)