Hi
I’ve been successfully using the code on thread436-1721678 (closed thread) since the answer was given, but have run in to a problem now that the date field has changed.
I have added an extra date column after reviewdate for authoriseddate.
The powers that be want to see a report that shows the same report as above but based on authoriseddate, not reviewdate.
The problem is that when I added the new column, all existing records placed 0000-00-00 into the authoriseddate column, only new records have a real date in this field.
Running the report above replacing authoriseddate with reviewdate is also returning the results where authoriseddate = 0000-00-00 i.e. all of the results before this new field was added.
I tried to add a new clause to exclude the early comments
But this had no effect on the results returned, also in the results the authoriseddate column is showing NULL.
Can anyone help?
I’ve been successfully using the code on thread436-1721678 (closed thread) since the answer was given, but have run in to a problem now that the date field has changed.
Code:
SELECT u . * , r.c
FROM products p
LEFT OUTER JOIN (
SELECT productid, COUNT( reviewid ) AS c
FROM reviews
WHERE (reviewdate BETWEEN CAST('2013-01-01' AS DATE) AND CAST('2014-06-16' AS DATE) )
GROUP BY productid
)r ON r.productid = p.productid
WHERE (r.c IS NULL || r.c =0)
AND manu = ‘xyz'
GROUP BY p.productid
I have added an extra date column after reviewdate for authoriseddate.
The powers that be want to see a report that shows the same report as above but based on authoriseddate, not reviewdate.
The problem is that when I added the new column, all existing records placed 0000-00-00 into the authoriseddate column, only new records have a real date in this field.
Running the report above replacing authoriseddate with reviewdate is also returning the results where authoriseddate = 0000-00-00 i.e. all of the results before this new field was added.
I tried to add a new clause to exclude the early comments
Code:
SELECT u . * , r.c
FROM products p
LEFT OUTER JOIN (
SELECT productid, authoriseddate, COUNT( reviewid ) AS c
FROM reviews
WHERE (authoriseddate BETWEEN CAST('2013-01-01' AS DATE) AND CAST('2014-06-16' AS DATE) )
AND authoriseddate <> ‘0000-00-00’
GROUP BY productid
)r ON r.productid = p.productid
WHERE (r.c IS NULL || r.c =0)
AND manu = ‘xyz'
GROUP BY p.productid
But this had no effect on the results returned, also in the results the authoriseddate column is showing NULL.
Can anyone help?