Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need to calculate the frequency of information in a database?? Help!
Old 09-01-2008, 11:36 AM Need to calculate the frequency of information in a database?? Help!
digitalfusion's Avatar
Skilled Talker

Posts: 73
Name: Martin
Location: Fife, Scotland
Trades: 0
Hi All,

I'm looking to try and work out how many times a userid appears in a database so i can work out who has the most Hugs in my bebo application.

Is there anyway to be able to do this?

Any help would be greatly appreciated.

Regards,
Martin
__________________
---------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
digitalfusion is offline
Reply With Quote
View Public Profile Visit digitalfusion's homepage!
 
 
Register now for full access!
Old 09-01-2008, 01:00 PM Re: Need to calculate the frequency of information in a database?? Help!
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
SELECT COUNT(column) as aliasname FROM table WHERE useridcolumn = userid;
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-01-2008, 06:27 PM Re: Need to calculate the frequency of information in a database?? Help!
digitalfusion's Avatar
Skilled Talker

Posts: 73
Name: Martin
Location: Fife, Scotland
Trades: 0
Quote:
Originally Posted by chrishirst View Post
SELECT COUNT(column) as aliasname FROM table WHERE useridcolumn = userid;
This is good, but i need to be able to dynamically check everyones id's against it then check which one is the most.

Also what do you mean by aliasname? (Username?)

Regards,
Martin
__________________
---------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
digitalfusion is offline
Reply With Quote
View Public Profile Visit digitalfusion's homepage!
 
Old 09-01-2008, 07:31 PM Re: Need to calculate the frequency of information in a database?? Help!
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
SELECT MAX(COUNT(column)) AS alias FROM table

alias sets a name so you can refer to it in the result recordset ( $result['alias'] )
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-01-2008, 08:32 PM Re: Need to calculate the frequency of information in a database?? Help!
digitalfusion's Avatar
Skilled Talker

Posts: 73
Name: Martin
Location: Fife, Scotland
Trades: 0
Quote:
Originally Posted by chrishirst View Post
SELECT MAX(COUNT(column)) AS alias FROM table

alias sets a name so you can refer to it in the result recordset ( $result['alias'] )
Thanks for your help, but i've decided its easier to just set a counter in the users table which will count them up everytime a hug is sent to the user etc.. and that way its just a simple sql query to get the one with the most.

Thanks Anyway your help is much appreciated.

Regards,
Martin
__________________
---------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
digitalfusion is offline
Reply With Quote
View Public Profile Visit digitalfusion's homepage!
 
Reply     « Reply to Need to calculate the frequency of information in a database?? Help!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51995 seconds with 12 queries