I have a query that looks like this.
SELECT COUNT( * ) AS num
FROM leads_user_sends, tblregion.sRegion AS region
JOIN tecknat_posts ON tecknat_posts.id = postId
JOIN tblorter ON tblorter.cIdOrt = tecknat_posts.city
OR tblorter.cIdOrt = tecknat_posts.city2
OR tblorter.cIdOrt = tecknat_posts.city3
JOIN tblregion ON tblregion.cIdRegion = tblorter.cIdRegion
WHERE sentDate >= '2005-04-26'
AND sentDate <= '2005-05-26'
AND tblorter.cIdRegion
IN ( 9, 18, 20 )
GROUP BY region
That returns: Access denied for user: 'lokalguiden_se@%' to database 'tblregion'
tblregion isn't even a database, it's a table.
But if I change it to
SELECT COUNT( * ) AS num
FROM leads_user_sends
JOIN tecknat_posts ON tecknat_posts.id = postId
JOIN tblorter ON tblorter.cIdOrt = tecknat_posts.city
OR tblorter.cIdOrt = tecknat_posts.city2
OR tblorter.cIdOrt = tecknat_posts.city3
JOIN tblregion ON tblregion.cIdRegion = tblorter.cIdRegion
WHERE sentDate >= '2005-04-26'
AND sentDate <= '2005-05-26'
AND tblorter.cIdRegion
IN ( 9, 18, 20 )
it doesn't complain. But I need to group by the name in region, so how am I supposed to get arround this?
Thanx in advance