Count related records
Database
2
Posts
2
Posters
0
Views
1
Watching
-
Hi there, I have a stock table and a barcode table. A stock can have many barcode records and a barcode belongs to only one stock. How can I query the database, so as it returns me those stock which have more than one barcode? Thanks for helping, David
-
Hi there, I have a stock table and a barcode table. A stock can have many barcode records and a barcode belongs to only one stock. How can I query the database, so as it returns me those stock which have more than one barcode? Thanks for helping, David
select StockCode, count(*) BarcodeCount from BarCode group by StockCode having count(*) > 1