Page 1 of 1

MySQL timestamp to date

Posted: Wed Mar 29, 2006 12:25 am
by NeoNmaN
Hai all.

I look in my MySQL and i hav INSERT relly mouch data ind then and now i whot to convert timestamp to date ( yyyy-mm-dd ) soe i can get this comment to work

Code: Select all

$GetBrowser = mysql_query("SELECT countrynick, DATE(runtime), COUNT(DISTINCT ipaddress) AS Count FROM besog_log WHERE kundeid = '$UserID' GROUP BY countrynick, DATE(runtime) ORDER BY Count DESC");
and tell my about ist right function to :)

thx for all help :)

Posted: Wed Mar 29, 2006 12:34 am
by NeoNmaN
i get it ;)

Code: Select all

SELECT countrynick, COUNT(DISTINCT ipadresse) AS Count FROM besog_log WHERE kundeid = '$UserID' GROUP BY countrynick, DATE_FORMAT(runtime, '%Y-%m-%d') ORDER BY Count DESC

Posted: Wed Mar 29, 2006 12:44 am
by NeoNmaN
Arrr :( Now ist not working :(..... ist dont take the count whit up if i hav same ipadrsse whit 2 days bot onlye the one day.

Posted: Wed Mar 29, 2006 1:18 am
by NeoNmaN
Now i hav this code

Code: Select all

SELECT countrynick, COUNT(DISTINCT ipadresse) AS Count, FROM_UNIXTIME(runtime, '%Y-%m-%d') AS DateNow FROM besog_log WHERE kundeid = '6' GROUP BY countrynick, FROM_UNIXTIME(runtime, '%Y-%m-%d') ORDER BY Count DESC
bot is return this dato to me

countrynick Count DateNow
DK - 21 - 2006-03-28
XX - 4 - 2006-03-28
DK - 1 - 2006-03-29
US - 1 - 2006-03-28
BG - 1 - 2006-03-28

i will hav it to look like follow

countrynick Count
DK - 22
XX - 4
US - 1
BG - 1