So I have received this error: #1066 - Not unique table/alias: \'Purchase\'
I am trying to do the following:
SELECT Blank.BlankTypeCode
You need a different alias for the table each time you use it.
SELECT B.BlankTypeCode, B.BlankCode, A1.Amount, A1.Type, P1.PurchaseDate, P1.DatePaid
FROM Blank AS B
JOIN Ticket AS T ON B.BlankCode = T.Blank_BlankCode
JOIN MCO_Blank AS M ON B.BlankCode = M.Blank_BlankCode
JOIN Purchase AS P1 ON T.PurchaseID = P1.PurchaseID
JOIN Purchase AS P2 ON M.PurchaseID = P2.PurchaseID
JOIN Payment AS A1 ON T.PurchaseID = A1.PurchaseID
JOIN Payment AS A2 ON M.PurchaseID = A2.PurchaseID
WHERE A1.Status = "Paid"
AND A2.Status = "Paid"
You'll need to sort out which versions of the Purchase and Payment tables the selected columns come from, and also what should be in the WHERE clause really.