|I've no idea what your DB looks like, but if you have a table containing a foreign key to another, then it's pretty simple.
Assume a Invoices system for simplicity. It contains two tables:
So to get the number of Lines per Invoice it's simple to use a group:
SELECT InvoiceID, COUNT(ID)
GROUP BY InvoiceID
So if I issue two invoices:
ID = 1, InvoiceDate = #2021-04-07#, ...
ID = 2, InvoiceDate = #2021-04-08#, ...
ID = 1, InvoiceID = 1, ...
ID = 2, InvoiceID = 1, ...
ID = 3, InvoiceID = 1, ...
ID = 4, InvoiceID = 1, ...
ID = 5, InvoiceID = 2, ...
ID = 6, InvoiceID = 2, ...
ID = 7, InvoiceID = 2, ...Then the query returns:
2, 3Which sounds like what you are looking for.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.