MySQL Query Help
Posted: Fri Jul 16, 2010 10:05 am
Hey everyone, I'm getting the following error when running a SELECT query:
It's a pretty complicated query, but it looks right to me. Can any of you spot the error? If it helps, line 202 is the last line in the following code:
Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/ehacsv/public_html/data.php on line 202
It's a pretty complicated query, but it looks right to me. Can any of you spot the error? If it helps, line 202 is the last line in the following code:
Code: Select all
$selectquery = mysql_query (
"SELECT data_id, data_timestamp, data_gas, data_electric, data_water FROM data WHERE (
data_reading_id = (
SELECT reading_id FROM readings WHERE (
reading_month = '$reading_month_prev' AND reading_year = '$reading_year_prev'
)
) AND data_property_id = '$property_id' AND data_timestamp = (
SELECT MAX(
data_timestamp
) FROM data WHERE (
data_reading_id = (
SELECT reading_id FROM readings WHERE (
reading_month = '$reading_month_prev' AND reading_year = '$reading_year_prev'
)
) AND data_property_id = '$property_id'
)
)
)"
);