Bug tracker
Every derived table must have its own alias [1248] (fix completed in vcs)
General Error
SQL ERROR [ mysql ]
Every derived table must have its own alias [1248]
SQL
SELECT COUNT(post_id) as total_results FROM (SELECT DISTINCT p.post_id FROM (phpbb2_search_wordmatch m0, phpbb2_posts p) WHERE m0.post_id = p.post_id AND m0.word_id = 16)
BACKTRACE
FILE: includes/db/mysql.php
LINE: 130
CALL: dbal->sql_error()
FILE: includes/search/fulltext_native.php
LINE: 622
CALL: dbal_mysql->sql_query()
FILE: search.php
LINE: 398
CALL: fulltext_native->keyword_search()
When it doesn't find anything it displays correctly that there are no posts matching that criteria.
Comments / History
- Code: Select all
$sql_array_count['SELECT'] = ($type == 'posts') ? 'DISTINCT p.post_id' : 'DISTINCT p.topic_id';
$sql = 'SELECT COUNT(' . (($type == 'posts') ? 'post_id' : 'topic_id') . ') as total_results
FROM (' . $db->sql_build_query('SELECT', $sql_array_count) . ')';
I am not sure, but subselects are only supported in mysql >= 4.1 and this code has been introduced for mysql3 as a replacement for SQL_CALC_FOUND_ROWS?
- Code: Select all
SELECT COUNT(p2.post_id) AS total_results
FROM (SELECT DISTINCT p.post_id FROM (phpbb_search_wordmatch m0, phpbb_posts p)
WHERE m0.post_id = p.post_id AND m0.word_id =16)
p2