This topic is locked
[SOLVED]

 sql query issue

2/19/2010 8:17:25 PM
PHPRunner General questions
R
Rens1976 author

Hi everyone

I'm using the following query:

Select resident_ID, date from bowel where date>= date_add(curdate(), interval-3 day) group by resident_ID having sum(Bristol_scale)<1;

on the query page the results come out the way I want. However once uploaded to the demo site I get the following error:

Technical information

Error type 256

Error description Unknown column 'bowel.Bristol_Scale' in 'having clause'

URL demo.asprunner.net/rens1976_optusnet_com_au/bowel/bowel_list.php?

Error file C:\UserAccounts\www\rens1976_optusnet_com_au\bowel_20100219043625\include\dbconnection.php

Error line 34

SQL query select count() from (SELECT bowel.Bowel_ID, bowel.Home_ID, bowel.Resident_ID, bowel.date, bowel.Shift, bowel.Result, bowel.Bristol_Scale, resident.Surname, resident.First_Name,(SELECT count() FROM (SELECT bowel.Resident_ID FROM bowel INNER JOIN resident ON bowel.Resident_ID = resident.Resident_ID WHERE (bowel.date >= date_add(curdate(), interval-3 day)) GROUP BY bowel.Resident_ID HAVING bowel.Bristol_Scale <1) subQuery_cnt WHERE subQuery_cnt.Resident_ID=bowel.Resident_ID) as Bowel record_cnt FROM bowel INNER JOIN resident ON bowel.Resident_ID = resident.Resident_ID where (bowel.date >= date_add(curdate(), interval-3 day)) GROUP BY bowel.Resident_ID having bowel.Bristol_Scale <1 ) a
More info
Call stack

File: line Function Arguments

0. include\dbconnection.php:34 db_query 1. select count(*) from (SELECT bowel.Bowel_ID, bowel.Home_ID, bowel.Resident_ID, bowel.date, bowel.Shift, bowel.Result, bowel.Bristol_Scale, resident.Surname, resident.First_Name,(SELECT cou...;

  1. Resource id #9;

    1. include\commonfunctions.php:1866 gSQLRowCount_int 1. SELECT bowel.Bowel_ID, bowel.Home_ID, bowel.Resident_ID, bowel.date, bowel.Shift, bowel.Result, bowel.Bristol_Scale, resident.Surname, resident.First_Name,(SELECT count(*) FROM (SELECT bow...;


  2. FROM bowel INNER JOIN resident ON bowel.Resident_ID = resident.Resident_ID;
  3. (bowel.date >= date_add(curdate(), interval-3 day));
  4. GROUP BY bowel.Resident_ID ;
  5. bowel.Bristol_Scale <1;
  6. ;
  7. 1;

    2. classes\listpage.php:1645 ListPage->buildSQL N/A

    3. classes\listpage.php:2539 ListPage->prepareForBuildPage N/A




Any ideas what my be causing this?

Regards

Rens