I have following table as LocalBarcode:
我有以下表格作为LocalBarcode:
and following as Barcodecancel cancel :
下面是Barcodecancel cancel:
I want to take:
我想要:
-
count of total barcodes
计算总额的条形码
-
count of barcodes whose IsUpload is true
条形码的计数,其IsUpload为真
from LocalBarcode and
从LocalBarcode和
- count of Barcode whose isUpload is true
- isUpload为true的条码计数
from BarcodeCancel.
从BarcodeCancel。
I designed following query:
我设计了以下查询:
select localbarcode.(select count(barcode)
from localbarcode
where Int([TimeStamp])= Format(CDate('10/18/2013'))),
localbarcode.(select count(isupload)
from localbarcode
where isupload=0),
BarcodeCancel.(select count(barcode)
from BarcodeCancel
where Int([TimeStamp])= Format(CDate('10/18/2013')))
from localbarcode,BarcodeCancel
But this query is giving me error on first line.
但是这个查询在第一行给了我错误。
Please help me.
请帮助我。
EDIT:
编辑:
3 个解决方案
#1
1
select (select count(barcode)
from localbarcode
where Int([TimeStamp])= Format(CDate('10/18/2013'))),
(select count(isupload)
from localbarcode
where isupload=0),
(select count(barcode)
from BarcodeCancel
where Int([TimeStamp])= Format(CDate('10/18/2013')))
from dual
You need to use the dummy table "dual". I made a simplified try out: http://sqlfiddle.com/#!2/15291/3
您需要使用虚拟表“dual”。我做了一个简化的尝试:http://sqlfiddle.com/#!2/15291/3
#2
1
You can also get result using following query:
您还可以通过以下查询获得结果:
select count(*) barcodes_total, (select count(*) from LocalBarcode where IsUpload =1) barcodes_upload_total, (select count(*) from Barcodecancel where IsUpload =1) Barcodecancel_upload_total from LocalBarcode
选择count(*) barcodes_total,(从LocalBarcode中选择count(*),其中IsUpload =1) barcodes_upload_total,(从Barcodecancel中选择count(*),其中IsUpload =1) barcodecel_upload_total
#3
1
You can get required output using following query:
您可以使用以下查询获得所需的输出:
select count(LocalBarcode.Barcode), count(lb.Barcode), count(lb1.Barcode) from LocalBarcode left join LocalBarcode lb on LocalBarcode.Barcode = lb.Barcode and LocalBarcode.IsUpload = 1 left join Barcodecancel lb1 on LocalBarcode.Barcode = lb1.Barcode and LocalBarcode.roleIsUpload = 1
在LocalBarcode中选择count(LocalBarcode. barcode)、count(lb. barcode)、count(lb1.Barcode)。条码= lb.Barcode和LocalBarcode。IsUpload = 1左加入Barcodecancel lb1上的LocalBarcode。条形码=两派。条形码和LocalBarcode。roleIsUpload = 1
#1
1
select (select count(barcode)
from localbarcode
where Int([TimeStamp])= Format(CDate('10/18/2013'))),
(select count(isupload)
from localbarcode
where isupload=0),
(select count(barcode)
from BarcodeCancel
where Int([TimeStamp])= Format(CDate('10/18/2013')))
from dual
You need to use the dummy table "dual". I made a simplified try out: http://sqlfiddle.com/#!2/15291/3
您需要使用虚拟表“dual”。我做了一个简化的尝试:http://sqlfiddle.com/#!2/15291/3
#2
1
You can also get result using following query:
您还可以通过以下查询获得结果:
select count(*) barcodes_total, (select count(*) from LocalBarcode where IsUpload =1) barcodes_upload_total, (select count(*) from Barcodecancel where IsUpload =1) Barcodecancel_upload_total from LocalBarcode
选择count(*) barcodes_total,(从LocalBarcode中选择count(*),其中IsUpload =1) barcodes_upload_total,(从Barcodecancel中选择count(*),其中IsUpload =1) barcodecel_upload_total
#3
1
You can get required output using following query:
您可以使用以下查询获得所需的输出:
select count(LocalBarcode.Barcode), count(lb.Barcode), count(lb1.Barcode) from LocalBarcode left join LocalBarcode lb on LocalBarcode.Barcode = lb.Barcode and LocalBarcode.IsUpload = 1 left join Barcodecancel lb1 on LocalBarcode.Barcode = lb1.Barcode and LocalBarcode.roleIsUpload = 1
在LocalBarcode中选择count(LocalBarcode. barcode)、count(lb. barcode)、count(lb1.Barcode)。条码= lb.Barcode和LocalBarcode。IsUpload = 1左加入Barcodecancel lb1上的LocalBarcode。条形码=两派。条形码和LocalBarcode。roleIsUpload = 1