Page 1 of 1

MySQL Query returns undesired data

Posted: Wed Mar 29, 2006 1:45 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

Posted: Wed Mar 29, 2006 1:50 am
by RobertGonzalez
Select what you want and don't select what you don't want.

Code: Select all

<?php
$sql = "SELECT countrynick, COUNT(DISTINCT ipadresse) AS Count 
        FROM besog_log 
        WHERE kundeid = '6' 
        GROUP BY countrynick
        ORDER BY Count DESC";
?>

Posted: Wed Mar 29, 2006 2:04 am
by NeoNmaN
No sorry :(


countrynick Count
DK 22
XX 4
US 1
BG 1

That ist whot ist post... i whot to get a unik day and unik ip adresse counts... and all whit sam countrynick most be count to getter

Posted: Wed Mar 29, 2006 2:06 am
by JayBird
Please can you not make new topics when you alreay had a topic about this exact problem.

Ive closed the other topic

Posted: Wed Mar 29, 2006 2:24 am
by NeoNmaN
How can i close the order topic ?

Posted: Wed Mar 29, 2006 2:43 am
by JayBird
NeoNmaN wrote:How can i close the order topic ?
You dont, i did it...just dont start new topics when you already have one running on the same subject.

Saves me a job ;)

Posted: Wed Mar 29, 2006 2:45 am
by NeoNmaN
Ist okay :) i try to not doe it ;)

bot can you maby help my whit this sux problem? :(

Posted: Wed Mar 29, 2006 3:03 am
by jrd
could you elaborate on what you want exactly?

Posted: Wed Mar 29, 2006 3:13 am
by NeoNmaN
i will only get unik ipadresse from my SQL whit timestamp = samm day thist unik ip is postet ind. and grop all contry soe if you go on my site eks. soe i wil get contry code back if you dit et to morro soe i wil get a new unik ip bot you hav a samm ip bot ist 2 days... soe now if i whot to conut today and tomorry to getter soe i whot to use a order SQL code on this

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
soe i can get eks.

DK = 5

or not

DK = 2 - Day 1 <- 2 unik ips
DK = 3 - Day 2 <- 3 unik ips <- 2 ips from day1 eks.
total = DK 5

bot i i remove

FROM_UNIXTIME(runtime, '%Y-%m-%d')

in my grop by soe i only get total unik ips

DK = 3 ips for day1 and day2

i hob ist help

Posted: Wed Mar 29, 2006 10:15 am
by jrd
hmmmm.... You want a total of IP hits based on distinct dates. I usually code that kind of stuff under php using a loop. If it's possible to be done in sql, i'd like to know as well. :wink:

Posted: Wed Mar 29, 2006 10:25 am
by Roja
Usually, the number of misspellings and shortcuts in a post don't present (much) more than an annoyance, but I honestly wanted to help with this post, and cannot understand half the sentences.

Please, PLEASE, use common english, spell correctly, and restate the issue, so more people can help you. Not everyone is an english-speaking, AOL user, and understands terms like "Wot". Sorry, but there is a level where it is simply too much, and this thread has gone far beyond it.

Posted: Wed Mar 29, 2006 10:38 am
by RobertGonzalez
I think that might be the best the OP can do. His location says Denmark. I am guessing that his English is not as strong as the bulk of us around here.

This sounds funny, but read his post out loud and it almost sounds understandable.

Posted: Wed Mar 29, 2006 10:56 am
by patrikG
changed topic-title from "really need help now :/" to a more meaningful one.