This returns a list of testimonials that do NOT have a topic tag assigned to them (product = ‘Yes’ in the topics table). I’ve tried adjusting the MIN() / MAX() part of the query to give me just the opposite, a list of testimonials that do have at least one topic assigned that is designated as a product, but no success. Can someone spot something obvious that I’m overlooking?
Thanks!
SELECT
t.testimonialID,
c.product,
t.brandNeutral,
t.sufficientDetail,
t.usePhoto,
t.healthRelated,
t.title,
t.compliantTitle,
t.dateEditorEdit,
t.dateAdminEdit
FROM testimonials t
INNER JOIN
testimonialTopics b
ON
t.testimonialID = b.testimonialID
INNER JOIN
topics c
ON
b.topicID = c.topicID
WHERE
t.approved = 'Yes'
and t.compliantTitle is null
GROUP BY t.testimonialID
HAVING
MAX(c.product) < 'Yes'
ORDER BY
dateEditorEdit;
I tried that earlier. The query gives a different amount of resulting testimonials, but each have “No” or “Null” in the product column of the results. Could the problem be in the way I did my joins?
I did see that post where you said, “No”. And the portion of my query that you included is what I have as well. The only difference being the way you formatted the text. Forgive me, as I’m not bright enough to see what you’re getting at or suggesting.
But when I actually checked several testimonials from the list, they indeed had various product topics added to them. I’m not exactly sure why the product column has “No” for all testimonials, but the query is now producing the list of testimonials I am looking for.