bfulda
01-18-2007, 04:45 PM
Hey all,
I am using mysql 5.0,apache2 and php. My table, called sdata, looks like this:
mysql> describe sdata;
+-------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+----------------+
| id | varchar(6) | YES | | NULL | |
| name | varchar(25) | YES | | NULL | |
| server | varchar(25) | YES | | NULL | |
| description | varchar(8000) | YES | | NULL | |
| datetime | datetime | NO | | NULL | |
| event | varchar(25) | YES | | NULL | |
| refnum | mediumint(9) | NO | PRI | NULL | auto_increment |
+-------------+---------------+------+-----+---------+----------------+
7 rows in set (0.04 sec)
the datetime function will spit out dates as 'yyyy-mm-dd hh:mm:ss'
I need to be able to perform a search between two complete dates (between two different datetime's) and pull all data from the table between those two dates.
performing this only pulls up the last 30 records as far as I can tell:
mysql> select * from sdata order by sdata.datetime desc limit 30;
But when I do this, it will pull for 30 days worth of data, but the scope is to limited:
mysql> select * from sdata where name="Brad" order by sdata.datetime desc limit 30;
As was stated earlier between two completely different dates. So as you can see I'm not even close yet.
Im just trying to get a feel for dates in mysql and so far this part of my project is probably the most challenging so far. Any ideas? tia
brad dot fulda at logsa dot army dot mil
thanks,
Brad
I am using mysql 5.0,apache2 and php. My table, called sdata, looks like this:
mysql> describe sdata;
+-------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+----------------+
| id | varchar(6) | YES | | NULL | |
| name | varchar(25) | YES | | NULL | |
| server | varchar(25) | YES | | NULL | |
| description | varchar(8000) | YES | | NULL | |
| datetime | datetime | NO | | NULL | |
| event | varchar(25) | YES | | NULL | |
| refnum | mediumint(9) | NO | PRI | NULL | auto_increment |
+-------------+---------------+------+-----+---------+----------------+
7 rows in set (0.04 sec)
the datetime function will spit out dates as 'yyyy-mm-dd hh:mm:ss'
I need to be able to perform a search between two complete dates (between two different datetime's) and pull all data from the table between those two dates.
performing this only pulls up the last 30 records as far as I can tell:
mysql> select * from sdata order by sdata.datetime desc limit 30;
But when I do this, it will pull for 30 days worth of data, but the scope is to limited:
mysql> select * from sdata where name="Brad" order by sdata.datetime desc limit 30;
As was stated earlier between two completely different dates. So as you can see I'm not even close yet.
Im just trying to get a feel for dates in mysql and so far this part of my project is probably the most challenging so far. Any ideas? tia
brad dot fulda at logsa dot army dot mil
thanks,
Brad