It seems what you are doing is selecting all rows that have miles not equal to a blank. SO you are displaying / selecting all rows that have miles = null and miles that have a value that is not a blank string "".
Change the where c.miles part to this: $sql .= " WHERE c.miles = "" or c.miles is NULL; Hope that helps, Anoop On 4/18/07, Anoop kumar V <[EMAIL PROTECTED]> wrote:
Can you share the table create scripts? You need to send us the output of show create table OWNER.CONFERENCE; Also send across some sample data. ANoop On 4/18/07, Katie L. Barbee <[EMAIL PROTECTED]> wrote: > > I believe this is a very simple question or at least I'm hoping ... > > I am trying to select items from a table where the miles field is not > null or blank and the below statement does not work. Does anyone have > any suggestions? > > Thanks! > > > > @resultkeys = ("Date","People","Miles","Savings"); > > $sql = "SELECT c.objectid,c.dateadded as > \"Date\",c.totalpeople as \"People\", "; > > $sql .= "c.miles as Miles, c.totalsaved as \"Savings\" "; > > $sql .= "FROM OWNER.CONFERENCE c"; > > $sql .= " WHERE c.miles <> ""; > > $sql .= " ORDER BY c.datestart"; > >