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 8 2528
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
"strawberry" <za*******@gmail.comwrote:
>
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
Sorry its standard testing for me, but that shows exactly what i want
it to show:
SELECT * FROM tablename HAVING 'updated' '2006-11-16 23:25:22' ORDER
by 'updated'
--
/Keith
"strawberry" <za*******@gmail.comwrote:
>
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
Keith wrote:
"strawberry" <za*******@gmail.comwrote:
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?
> I created a query like this: "SELECT * FROM tablename WHERE 'updated'
> '$startstring' ORDER BY 'updated'"
Note that this query does not reference the updated field at all,
except for the "select *" part.
>// $startstring holds the date-time string exactly like the 'updated' field should look.
'updated' is a string, not a field name.
>In the much more efficient WHERE clause it does not work.
Where am i going wrong?
`updated` is a field name. 'updated' is a string.
"strawberry" <za*******@gmail.comwrote:
>
Keith wrote:
"strawberry" <za*******@gmail.comwrote:
>
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?
SELECT * FROM tablename HAVING 'updated' '2006-11-16 23:25:22' ORDER
by 'updated'
returns all records from the database not only those updated after
2006-11-16 23:25:22 go***********@burditt.org (Gordon Burditt) wrote:
I created a query like this: "SELECT * FROM tablename WHERE 'updated'
'$startstring' ORDER BY 'updated'"
Note that this query does not reference the updated field at all,
except for the "select *" part.
// $startstring holds the date-time string exactly like the 'updated'
field should look.
'updated' is a string, not a field name.
In the much more efficient WHERE clause it does not work.
Where am i going wrong?
`updated` is a field name. 'updated' is a string.
Wow, never saw that those back-ticks were so important, I always used
normal ticks and it worked, but not now.
THANK YOU
Keith wrote: go***********@burditt.org (Gordon Burditt) wrote:
>>> I created a query like this: "SELECT * FROM tablename WHERE 'updated' '$startstring' ORDER BY 'updated'"
Note that this query does not reference the updated field at all, except for the "select *" part.
>>>// $startstring holds the date-time string exactly like the 'updated' field should look.
'updated' is a string, not a field name.
>>>In the much more efficient WHERE clause it does not work.
Where am i going wrong?
`updated` is a field name. 'updated' is a string.
Wow, never saw that those back-ticks were so important, I always used
normal ticks and it worked, but not now.
THANK YOU
if updated is a column name then the query should look like:
SELECT * FROM tablename HAVING updated '2006-11-16 23:25:22' ORDER
by updated;
Depending on your datefield you may need to "convert" the time to something the
database can actually use.
It is always a good idea to test your select statements interactively before
moving it to your applciation.
--
Michael Austin.
DBA Consultant This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rdraider |
last post by:
I am looking for some assistance with an update query that needs to link 3
tables:
This query ran and reported over 230,000 records affected but did not change
the field I wanted changed, not...
|
by: James |
last post by:
Hello Everyone!
I'm trying to design a database for a library that stocks a range
of media. (see link)
http://homepage.ntlworld.com/james.merrie/private/library.gif
Each user can make many...
|
by: Neil Hindry |
last post by:
I wonder if you can help me.
I have setup an address-book database in Access XP. I have the first name &
surname as separate fields. As I wanted to sort my database by surname and
then by first...
|
by: Jim Archer |
last post by:
Hi All...
I'm been fighting this problem for a few days now, and it seems like it
should be simple. But the solution has eluded me so far...
I need to flag a record when it is updated or when...
|
by: phillip.s.powell |
last post by:
Now I have another SQL query for MySQL I can't figure out!! This is
overwhelming me completely and I also must have this figured out today
and I can't figure it out!!
UPDATE student_db.student...
| |
by: rdraider |
last post by:
Hi all,
I know squat about triggers so was hoping somebody could point me in the
right direction. I wanted to copy an email address field from a salesman
table to a note field in a customer...
|
by: casper christensen |
last post by:
Hi
I run a directory, where programs are listed based on the number of
clicks they have recieved. The program with most clicks are placed on
top and so on. Now I would like people to be apple to...
|
by: jon |
last post by:
Hi there,
I'm brand new to Access and may be trying to do too much too soon, but
I wanted to get some expert advice on how the best way to go about what
I am trying to accomplish would be.
I...
|
by: 08butoryr |
last post by:
Hey guys I could really use your help with some very basic java programming. I know you programming fundis out there will find this child's play but I'm struggling with it a bit because I'm...
|
by: Paul David Buchan |
last post by:
Hello,
I'm attempting to write a program to read in database files (.dbf).
When I do it all as a single procedure in main, everything works.
However, what I really want, is to pass the database...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |