I want to join two tables
One is a relations table with multiple enteries for UserID and the other is a profile table with user information also has the UserID
I want to do a search on how often a relation occurs based on a search of the profile name and the same UserId in both.
Something like
select , count() AS cnt FROM profile, relations WHERE profile.name "
." LIKE '%$namesearch%' GROUP BY relations.UserID ORDER BY cnt DESC
but this does not work