Convictions
Programmer
- Mar 29, 2008
- 3
First, thank you for taking the time to read this.
I have a table named `Tags` which consists of my site members tags (words stripped from their about me sections) - this table has two columns: Tag, profile.
Tag is the word, profile is the ID of the member.
I am trying to have a query that outputs a member's tags that at least matches one other member's tag in the database. I have tried everything I can think of. Here is my code, and error generated:
The error is:
Query:
SELECT `Tag` as `user_tag` FROM `Tags` WHERE `Tags`.`profile`='1' AND EXISTS
(SELECT `Tag` FROM `Tags` WHERE `Tag` = `user_tag` AND COUNT( `Tags`.`Tag` ) > 2 GROUP BY `Tags`.`Tag`)
Mysql error:
Invalid use of group function
Any help will be greatly appreciated!
Thank you,
Chris
I have a table named `Tags` which consists of my site members tags (words stripped from their about me sections) - this table has two columns: Tag, profile.
Tag is the word, profile is the ID of the member.
I am trying to have a query that outputs a member's tags that at least matches one other member's tag in the database. I have tried everything I can think of. Here is my code, and error generated:
Code:
$sTagsQuery = "SELECT `Tag` as `user_tag` FROM `Tags` WHERE `Tags`.`profile`='{$p_arr['ID']}' AND EXISTS
(SELECT `Tag` FROM `Tags` WHERE `Tag` = `user_tag` AND COUNT( `Tags`.`Tag` ) > 2 GROUP BY `Tags`.`Tag`)";
$rTags = db_res( $sTagsQuery );
while( $aTags = mysql_fetch_assoc( $rTags ) )
{
$sTagsAddon .= "<a href='" . $site['url'] . "search_result.php?tag=" . $aTags['user_tag'] . "'>" . $aTags['user_tag'] . "</a>, ";
}
The error is:
Query:
SELECT `Tag` as `user_tag` FROM `Tags` WHERE `Tags`.`profile`='1' AND EXISTS
(SELECT `Tag` FROM `Tags` WHERE `Tag` = `user_tag` AND COUNT( `Tags`.`Tag` ) > 2 GROUP BY `Tags`.`Tag`)
Mysql error:
Invalid use of group function
Any help will be greatly appreciated!
Thank you,
Chris