|
Posted by strawberry on November 17, 2006, 7:13 pm
Please log in for more thread options
Keith wrote:
>
> >
> > Keith wrote:
> >
> > > I try to learn SQL by figuring out things.
> > >
> > > I want to make a listing of all records that were changed in the
> > > last... 1, 6, 12 hours/days.
> > >
> > > I have a field called 'updated' managed like: UPDATE tablename SET
> > > updated = NOW(), .... WHERE....
> > >
> > > I created a query like this: "SELECT * FROM tablename WHERE 'updated'
> > > > '$startstring' ORDER BY 'updated'"
> > >
> > > // $startstring holds the date-time string exactly like the 'updated'
> > > field should look.
> > >
> > > When in php i do: if($record[updated] > $startstring) ..show record..;
> > > it works, but then I must pull the entire database.
> > >
> > > In the much more efficient WHERE clause it does not work.
> > >
> > > Where am i going wrong?
> > > --
> > > /Kees
> >
> > try echoing the query
>
> Just realise: it does work, but it does not select so te whole
> database is pulled, so the WHERE clause does not do it's job.
> --
> /Keith
eh?
|