If you remember my post from a few days ago, this is the table structure that I'm now using (thanks CYoung and TonyGroves):
stamp DATETIME not null primary key,
year int(4) not null,
month int(2) not null,
day int(2) not null,
hour int(2) not null,
minute int(2) not null,
reading float(10,6) not null
How would I go about retrieving the results that have the most recent and most distant DATETIME from the above table? These are not necessarily the first and last rows entered in the database table, as the order in which files are parsed and entered into the database may not be chronological.
Apologies if this is remedial but I'm fairly new to sql.
I also need to fetch results by descending DATETIME. I'm guessing that this will do it:
"select * from siteTable
where stamp between $datetimeA
and $datetimeB
order by stamp desc"
I won't be able to test it out until tomorrow night. Can I do the 'order by desc' thing with datestamps?
stamp DATETIME not null primary key,
year int(4) not null,
month int(2) not null,
day int(2) not null,
hour int(2) not null,
minute int(2) not null,
reading float(10,6) not null
How would I go about retrieving the results that have the most recent and most distant DATETIME from the above table? These are not necessarily the first and last rows entered in the database table, as the order in which files are parsed and entered into the database may not be chronological.
Apologies if this is remedial but I'm fairly new to sql.
I also need to fetch results by descending DATETIME. I'm guessing that this will do it:
"select * from siteTable
where stamp between $datetimeA
and $datetimeB
order by stamp desc"
I won't be able to test it out until tomorrow night. Can I do the 'order by desc' thing with datestamps?