Database Schema is something like this:
Code:
table Issues:
IssueID
ContactID
Comments
table IssueProduct:
IssueID
ProductID
table Products:
ProductID
ProductName
I need to use the IssueProduct table so each issue can support multiple products.
I would like to query ONLY the last 50 Issues.
The problem here is that if an issue has multiple products, it will show up as as a dupplicate issue id on a new row with the other product id.
I could write programs to find for a repeated IssueID, however I can not figure out how to make it return 50 seperate issues if a multiple product issue is found.
For Example. If one of the 50 issues has 2 products assigned to it, .. then my query would only result in 49 issues.
this is a much lighter version of the actual query, with only the necessary fields to ask this question.
Code:
SELECT Issues.ContactID,Issues.Comments,Products.ProductName
WHERE Issues.IssueID='1'
AND Issues.IssueID=IssueProduct.IssueID
AND IssueProduct.ProductID=Products.ProductID
ORDER BY IssueID DESC LIMIT 50