Re: rewriting this SQL query to remove subselect
| From: | Ifrim Sorin | Date: | Mon, 12 Feb 2001 07:18:49 +0000 |
| Subject: | Re: rewriting this SQL query to remove subselect | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-39179@lists.php.net to get a copy of this message | ||
You could try a two step query:
$querywords="CREATE TABLE temptable SELECT ... ";
$sel_querywords=mysql_query($querywords);
$search = "SELECT count(search_table.word) as score,
search_table.qid,page_data.contents
FROM search_table,page_data,temptable
WHERE page_data.pID = search_table.qid AND search_table.word =
temptable.word
GROUP BY search_table.qid
ORDER BY score DESC";
then drop temptable .
HTH
Sorin Ifrim
Scott Mebberson <scott@redbluedesign.com> wrote in message
news:967ab7$t1$1@toye.p.sourceforge.net...
> Hi Guys,
>
> I understand that as of version 3.24, MySQL will support subselects. But
> untill then (because 3.23 is the latest stable release) I need to convert
> this SQL satement into something that can be used with v3.2? - the
version
> just before the latest release.
>
> $search = "SELECT count(search_table.word) as score,
> search_table.qid,page_data.contents
> FROM search_table,page_data
> WHERE page_data.pID = search_table.qid AND search_table.word
> IN($querywords)
> GROUP BY search_table.qid
> ORDER BY score DESC";
>
> Does anybody have any ideas, thanks for this guys. Any help is much
> appreciated.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>