Oops, forgot to mention that with the alias you can change the ORDER BY
clause to use the aliased column data:
ORDER BY solarLandingDate DESC
this will only use the returned data instead of the entire column.
If you are aliasing a column it is better to use the optional AS keyword
to avoid confusion.
MySQL's DATE function returns dates formatted as 'YYYY-MM-DD' so
is not needed here.
thanks for your efforts to lead me to understanding this!
I tried everything you both suggested.
Ideally I would have some clear docs that outline the syntax for me, for
such an example as I need.. and I would be able to check my code myself.
Meanwhile, In every case, I just get every record in the table back as a
So then I thought, "try and make even a *simple* DISTINCT work, and then
move on to the date thing"... so I try this:
//$foundTrackingRows=mysql_query("SELECT DISTINCT solarLandingDir,
solarLandingIP, solarLandingDir, solarLandingDateTime FROM
".$whichTable." ORDER BY solarLandingDateTime DESC LIMIT $Maxrecs2Show")
or die("query failed: " .mysql_error());
In all the records in this table, there are only 3 possible values in
the 'solarLandingDir' column (TINYTEXT):
but I still get all the records back, with each distinct
'solarLandingDir' column value represented several times.
Provide an example of what you have now, and what you want to get back.
We're all just guessing what you're trying to do so an example might
help us understand and help you better.
Postgresql & php tutorials
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php