我有以下代码联合两个选择语句,但第二个选择开始选择2.这是什么?select 2在联合sql语句中的含义是什么?
select tax_type, sum(amount) from bill_tax_tbl a (index multi), bill_summ_tbl b where a.customer_no = @customer_no and a.invoice_month = convert(tinyint,datepart(mm,dateadd(mm,-1,convert(datetime,@date)))) and a.job = b.job and a.billing_sub_job = b.billing_sub_job and b.job_group is null group by tax_type union select 2, sum(amount) from bill_tax_tbl a (index multi), bill_summ_tbl b where a.customer_no = @customer_no and tax_type = 1 and a.invoice_month = convert(tinyint,datepart(mm,dateadd(mm,-1,convert(datetime,@date)))) and a.job = b.job and a.billing_sub_job = b.billing_sub_job and b.job_group is null
它在行tax_type'等于设置''到2'由第二个子查询返回。 –