"Select failed" error messagegreenspun.com : LUSENET : WebdesignII : One Thread
when I execute the select statement below I get the error message below:
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.") while executing "ns_db select $db $query" invoked from within "set selection [ns_db select $db $query] " (file "/web/antl/www/oevelse9/view_all_single.tcl" line 12) invoked from within "source $file"
Here's the SELECT part of my script:
set query "select rest_name,rest.rest_id,review,name,avg(rating)as average from rating,rest where rest.rest_id = '$rest_id' group by rest_name,rest.rest_id,review,name order by average desc"
# Perform the query set selection [ns_db select $db $query]
The error message seems to indicate something is wrong with my select statement. But when I run it in the sql prompt, where I substitute rating.rest_id for the $rest_id above, it works fine.
Can anyone see what the problem might be????
-- Tony (firstname.lastname@example.org), April 20, 2002
You need to expand your where-clause with a link between the to tables involved, i.e. add a 'where rest.rest_id=rating.rest_id'...
-- Lasse (email@example.com), April 20, 2002.