Complex multiple query breaks Pagination
Asked by
Brian Rippon
I'd like to use a complex multiple query with Pagination, but it generates an SQL error. The SQL I'd like to use takes the form
SELECT PreQuery.Id, c.Price
FROM
( SELECT
c.Id, MAX(c.aDate) Latest
FROM prices c
GROUP BY
c.IId ) PreQuery, products p, prices c
WHERE
PreQuery.Id = p.Id
AND PreQuery.Id = c.Id
AND PreQuery.Latest = c.aDate
However both SELECT phrases are factored breaking the SQL.
[don't worry about what the SQL is trying to achieve, the latest price for a product, although other suggestions for SQL that does work gratefully received!]
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- PHPDevShell Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Brian Rippon
- Solved:
- Last query:
- Last reply:
To post a message you must log in.