Jump to content

Recommended Posts

Hi guyz...its me again heheheh....i was wondering how to view only the recent data by refferring to its date my querying seems to be wrong...

For example:

a customer paid at the date of 2006-03-02...this is the last time he paid....so when i view his information the most recent date would be or should be view "2006-03-02"...not 2006-03-01...not 2006-02-28....etc...

$query = "SELECT * FROM dataz WHERE username = '$username' AND Dated = MAX(Dated) AS most";

"in here i have errors i know my placing of "max(date) as most" is wrong...this comes in handy if i do this"


$query = "SELECT *, MAX(Dated) AS most FROM dataz WHERE username = '$username'";


"i was wondering how could i do this in terms of using WHERE....."

Algorithm: Select everything from dates where this is the user and the date of the user is the most recent...



tnx...^__^
Link to comment
https://forums.phpfreaks.com/topic/4304-trouble-using-max-date/
Share on other sites

[!--quoteo(post=352420:date=Mar 7 2006, 02:37 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 7 2006, 02:37 AM) [snapback]352420[/snapback][/div][div class=\'quotemain\'][!--quotec--]
pull them in descending date order

[code]$query = "SELECT * FROM dataz WHERE username = '$username' ORDER BY dated DESC LIMIT 1";[/code]
[/quote]



Thanks Sir Barand ^____^
Link to comment
https://forums.phpfreaks.com/topic/4304-trouble-using-max-date/#findComment-14997
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.