Let’s say I got a table of Clients (tblClients) and a table of quotes (tblQuotes).
To get all quotes from our existing client, I did the following:
SELECT q.quoteId, c.contact, q.job,
FROM tblQuotes AS q
INNER JOIN tblClients AS c ON q.user = c.user
For each quote, we got a date the quotes was created. That date is in tblDate. The only way I found for displaying that date is when I display my records, I do an other request like this:
SELECT Date
FROM tblDate
WHERE id = %1 => %1 is q.quoteId
Everything works fine, but I decided to add inputs that alternate the SQL request. For example, c.Contact can be “John”
WHERE c.Contact = 'John'
How about the Date? I can easily get q.quoteId, c.Contact and q.Job but I don’t know how to make it work with Date too.
WHERE c.Contact = 'John' AND ...
Just add another join (use INNER JOIN assuming each quote has a date value):
You can then modify accordingly to specify any additional criteria using the
WHEREclause: