Jump to content

Mysql sort question


guitarist809

Recommended Posts

Hello. I've got a little problem that I think is easy to resolve.

 

I'm grabbing a bunch of entries from a table with a date field (YYYY-MM-DD), but I only want one field per day

 

for example, I might have a few entries for 2005-03-25, but I only want the first of that.

 

I was looking at those JOIN things, but I couldn't figure them out.

 

 

 

Can anybody help me?

 

Thanks,

 

-Matt

Link to comment
https://forums.phpfreaks.com/topic/42843-mysql-sort-question/
Share on other sites

Not Necessairly.

 

Take this example of a table

 

[date]      [value]

[2007-1-1] [valueasdf]

[2007-1-1] [valuasdfe]

[2007-1-2] [valuade]

[2007-1-3] [vafalue]

[2007-1-3] [vadfalue]

[2007-1-3] [valdfue]

[2007-1-4] [valsdfaue]

[2007-1-4] [valdsue]

[2007-1-5] [valfdue]

[2007-1-8] [valsfue]

 

I just want MySQL to return this

[2007-1-1] [valueasdf]

[2007-1-2] [valuade]

[2007-1-3] [vafalue]

[2007-1-4] [valsdfaue]

[2007-1-5] [valfdue]

[2007-1-8] [valsfue]

 

Notice how none of the dates are the same.

I dont care what it returns, just as long as there are no equal dates.

The reason I dont care is because i'm not taking the value, its just counting each day.

Link to comment
https://forums.phpfreaks.com/topic/42843-mysql-sort-question/#findComment-208142
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.