I am trying to create an app for the salespeople who work for my company to keep track of their sales/commission
When a salesperson brings on an account, their name is noted on the account and the table might look like
Table B
| Account | Salesperson |
|:---------:|:-----------:|
| Account A | A |
| Account B | B |
| Account C | B |
| Account D | A |
Then the jobs list might look like
Table A
| Account | Job details | Price |
|:---------:|:-----------:|:-----:|
| Account A | xyz | £x |
| Account B | xyz | £x |
| Account C | xyz | £x |
| Account D | xyz | £x |
| Account A | xyz | £x |
| Account C | xyz | £x |
I am looking for a way to filter the results of table A based on the sales person noted next to the Account in Table B
I have looked at all of the
JOIN
options but am unsure I am using the correct one.
I have opted, currently, for
SELECT J.*, A.Company, A.SalesPerson FROM TableA A
INNER JOIN TableB B
ON A.Account= B.Account
Where A.Salesperson = "B"
This seems to work for the time being, however I am unsure wether this is the best Join to use and whether it will last the test of time
Asked by PaulMcF87
(177 rep)
Nov 29, 2022, 03:50 PM
Last activity: Nov 29, 2022, 11:45 PM
Last activity: Nov 29, 2022, 11:45 PM