Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 SQL CODE HELP
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

caxps
Starting Member

35 Posts

Posted - 28 November 2004 :  19:00:34  Show Profile  Visit caxps's Homepage
I have field called datedisplayed that shows date and time in the following format.

2004/09/17-08:28:38

I would like to extract all records that are in between the following dates. I use Access 2000

2004/01/01-08:00:00
2004/11/30-18:00:00

SELECT *
FROM datedisplayed
WHERE ????


Edited by - ruirib on 29 November 2004 00:12:01

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 28 November 2004 :  19:04:34  Show Profile
is it a date field or a text field?

can a moderator move this to a more appropriate forum (asp perhaps)

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 November 2004 :  00:12:41  Show Profile  Send ruirib a Yahoo! Message
Moved to Community Discussions (seemed the most adequate).


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 29 November 2004 :  04:34:24  Show Profile
You will have to use "FROM tablename", not fieldname, but try something like this :

select * from whateveryourtablenameis where datedisplayed > #2004/01/01-08:00:00# and datedisplayed < #2004/11/30-18:00:00#


That should be close
Go to Top of Page

caxps
Starting Member

35 Posts

Posted - 29 November 2004 :  10:23:12  Show Profile  Visit caxps's Homepage
Sorry not working...
I'm using the following:
SELECT *
FROM hits
WHERE datedisplayed > '#2004/01/01-08:00:00# and datedisplayed < #2004/11/30-18:00:00#'
ORDER BY datedisplayed ASC

But I'm getting...
2004/09/16-00:00:36 69.198.189.60
2004/09/16-00:00:36 212.113.164.104
2004/09/16-00:00:38 69.198.189.60
2004/09/16-00:00:38 69.198.189.60
2004/09/16-00:00:39 69.198.189.60

etc etc..

The datedisplayed is a TEXT field? is this the problem?


Edited by - caxps on 29 November 2004 11:21:33
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 29 November 2004 :  12:41:15  Show Profile
quote:
The datedisplayed is a TEXT field? is this the problem?

Probably. You're using a date comparison against a text field, so the db engine will probably be doing a string comparison rather than a date comparison. If your db supports it you could try a CONVERT or CAST on the stored string value to convert to a date value where the comparison should then work as expected.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 29 November 2004 :  15:18:08  Show Profile
As Doug G said, it's a bit harder with a text field. You also put in some quotes that I didn't have, but it doesn't matter because I was hoping it was a date/time field.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07