У меня более одного SQL-запроса (25, если быть точным), и я хочу вернуть результаты в виде одной строки результатов. например ...
- Получить штрих-коды, имеющие запись EnvPrint в базе данных
select count(distinct jtbarcode) as CountEP
from jobtracker with(nolock)
where jtprocess = 'EnvPrint' and jtbarcode in(Select lookupcode from data with(nolock) where clientid = 123 and batchid = 12345 and jobid = 1 and subjobid = 1 and entrytype<>'c' and entrytype<>'m')
GROUP BY jtBatchid
- Получить штрих-коды, имеющие запись VerifyEnvPrint в базе данных
select count(distinct jtbarcode) as CountEVP
from jobtracker with(nolock)
where jtprocess = 'Verify-EnvPrint' and jtbarcode in(Select lookupcode from data with(nolock) where clientid = 123 and batchid = 12345 and jobid = 1 and subjobid = 1 and entrytype<>'c' and entrytype<>'m')
GROUP BY jtBatchid
это производит
CountEP
18
Количество EVP
18
Можно ли вернуть одну строку с этими результатами в виде 2 отдельных столбцов?
Я попробовал Union, но он сделал 2 строки и один столбец