I track whenever a person marks a testimonial as a favorite in the favorites table. Today I decided to show a report of which testimonials have been marked as a favorite the most. This query works fine:
select tID, count(*) as number from favorites group by tID order by number desc;
So now I want to display the results on the website for my readers to see. In this case I need the actual title of each of these testimonials:
select t.title, f.tID, count (*) as number
from testimonies t inner join favorites f
on t.tID = f.tID
where number > 3
group by f.tID
order by number desc;
Can someone help me see why I’m getting a 1064 mySQL error?
Ugh. This didn’t work either. What am I doing wrong r937?
select t.summary, f.tID, count (*) as number
from testimonies t inner join favorites f
on t.tID = f.tID
group by f.tID
having number > 3
order by number desc;
Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘*’ at line 1