473,513 Members | 3,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to count max(users) created in a particular year using group function.

15 New Member
How to count number of users created in a perticular year.
ex.i want to count total number of users created in 2007using query.
Jan 7 '08 #1
1 1337
mwasif
802 Recognized Expert Contributor
You can use MySQL YEAR() function like below
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) FROM users_table WHERE YEAR(date_col)=2007
And if you want to know which year has the more registrations, use YEAR() in this fashion
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) AS users,  YEAR(date_col) AS registration_year FROM users_table
  2. GROUP BY registration_year
  3. ORDER BY users DESC
Jan 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2161
by: pankaj_wolfhunter | last post by:
Greetings, Sorry if this questions is too basic. just wanna know if the max function in db2 gives the result based on the ascii value or in ascending order. I tried but not able to figure out the result. Any help will be greatly appreciated TIA
2
5111
by: Robert | last post by:
When you use an aggregate function in a SELECT statement, you cannot specify any fields you want they way you usually can in a SELECT statement. Only fields that are part of the GROUP BY clause can be retrieved. How can I create a join to select a record from a table using the MAX function and then have use of all of the fields in that...
3
29020
by: John A Grandy | last post by:
does .NET have a Max() function ? something like MyMaxValue = Max(Value1,Value2,Value3,Value4)
3
13943
by: auron | last post by:
Hi there, I have a really stupid and banal problem with showing the results of a MySQL query in PHP, preciselly with MySQL count() function that gives to a variable in PHP the result. NOTE: The problem here is PHP not MySQL, in MySQL everything works just fine. Here is the query that I wrote for getting the number of how much
6
2495
by: jj_frap | last post by:
I'm new to programming in Python and am currently writing a three-card poker simulator. I have completed the entire simulator other than determining who has the best hand (which will be far more difficult than the aspects I've codes thus far)...I store each player's hand in a list of hand objects and I determine hand strength via a...
0
4520
by: DAnne | last post by:
I'm trying to do a simple count function in xslt and it's turning out to be extremely painful. I have a report that brings back a set of responses for each question per section in an Audit. I want to bring back the response only once (i.e. Na,Yes, No answers only once). I have this working. The part I'm having trouble with is the count. ...
0
2038
by: ambika_se | last post by:
hi all I need a help to use count function. I want to make a query in which i want to search for some keyword so the query i made was for $x in doc("file:///C:/Package1.xml")//Package where $x//node() return $x It works fine. But now i want to know how much times the word Science apperared in the XML. can i use funtion count here I...
3
1661
by: magmike | last post by:
Is there a way to set max users of a network shared database? We seem to be having a problem getting a fourth user (yes, it's a small office) onto the database. Or is there possibly something else going on? Thanks mike (the closest thing to an IT department our company has)
3
2705
by: ncsthbell | last post by:
I am trying to run a query in access using the 'max' function. For example, I have many rows of data, one for each state and each state has a column for 'Miles'. I want to get the highest number of miles so I am using the max function... Select max(miles) from table. It works and returns the largest number in this column. I also need the state...
16
4415
by: lovecreatesbea... | last post by:
It takes mu so time to finish this C source code line count function. What do you think about it? / ******************************************************************************* * Function : size_t linecnt(char *filenm); * Author : jhlicfoocbar@gmail.com, remove foobar for email * Date : 2008.4.12 * Description: C source...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7125
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4757
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.