brmbar-github/brmbar3/USEFUL.txt

8 lines
306 B
Text

Accounts with multiple barcodes:
SELECT accounts.name,barcodes.account,barcodes.barcode
FROM "barcodes"
join accounts on accounts.id = barcodes.account
where barcodes.account in (select a from (select count(*) as c, account as a from barcodes group by account) as dt where c > 1)
ORDER BY "account" DESC