Help with query
Posted: Wed Nov 21, 2007 9:49 am
feyd | Please use
what i am trying to do is select all userid's and find out how many times they viewed something so i did this:
that gave me this:
now i believe that is what i want. what i want to do now is get the userid where count( `viewed` ) is <= 1. so i tried this:
i got an error about the group function.
any help would be great
thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i have this table.Code: Select all
messageid int(11)
userid int(11)
entered datetime
viewed datetime
status varchar(255)Code: Select all
SELECT `userid` , count( `viewed` )
FROM `eblast_usermessage`
GROUP BY `userid`
LIMIT 0 , 30 Code: Select all
userid count( `viewed` )
1 22
2 35
3 14
4 48
5 10
6 20
7 2
8 2
9 3
10 30
11 1
12 0
13 5
14 5
15 0
16 0
17 3Code: Select all
SELECT `userid` , count( `viewed` )
FROM `eblast_usermessage`
where count( `viewed` ) <=1
GROUP BY `userid`any help would be great
thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]