473,805 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I want to have Grand total of Count(*)

8 New Member
I want to see how many people have registered from Countries and also want to Sum the total

Table fields
1. Name,
2. Email
3 Country

I use this query to get number of people registered against country
Expand|Select|Wrap|Line Numbers
  1. SELECT count(*) as COUNT , country as COUNTRY
  2. FROM `epoc_vreg_intersec` group by country
  3.  
Expand|Select|Wrap|Line Numbers
  1. COUNT     COUNTRY
  2. 1      
  3. 1     Azerbaijan
  4. 1     Bahrain
  5. 1     Canada
  6. 1     Germany
  7. 5     Iran
  8. 1     Japan
  9. 2     Jordan
  10. 7     Kuwait
  11. 4     Lebanon
  12. 2     Libyan Arab Jamahiriya
  13. 2     Oman
  14. 1     Pakistan
  15. 2     Qatar
  16. 2     Romania
  17. 12     Saudi Arabia
  18. 1     Syria
  19. 2     Thailand
  20. 2     Turkey
  21. 60     United Arab Emirates
  22. 5     United Kingdom
  23.  
Above query works but but i also want total of count field also using same query.
Sep 13 '07 #1
3 4403
mwasif
802 Recognized Expert Contributor
Thanks for using CODE tags. But use it where it requires.

Use WITH ROLLUP option
Expand|Select|Wrap|Line Numbers
  1. SELECT count(*) as COUNT, country as COUNTRY
  2. FROM `epoc_vreg_intersec` GROUP BY country WITH ROLLUP;
Sep 13 '07 #2
amitpatel66
2,367 Recognized Expert Top Contributor
Thanks for using CODE tags. But use it where it requires.

Use WITH ROLLUP option
Expand|Select|Wrap|Line Numbers
  1. SELECT count(*) as COUNT, country as COUNTRY
  2. FROM `epoc_vreg_intersec` GROUP BY country WITH ROLLUP;
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT count(*) AS COUNT, SUM(COUNT(*)) OVER() FROM epoc_vreg_intersec GROUP BY country
  3.  
  4.  
Sep 14 '07 #3
mwasif
802 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT count(*) AS COUNT, SUM(COUNT(*)) OVER() FROM epoc_vreg_intersec GROUP BY country
  3.  
  4.  
Hi amitpatel66,
Is this a valid MySQL syntax?
Sep 14 '07 #4

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

Similar topics

10
5990
by: giancarlodirisioster | last post by:
Can someone help me modify this for future Usenet archival and to help me solve what I don't know? <form name="addform" method="POST" action="./submit.php"> <input type="text" name="Box 1" size="20" value="100.50"> + <input type="text" name="Box 2" size="20" value="200.50"> + <input type="text" name="Box 3" size="20" value="1.50"> = <input type="text" name="Total" size="20" value="302.50"> </p> </form>
9
3077
by: Ericka | last post by:
I used the following query to count the number of records from each table. Select "Employee_Table" as Table_Name, Count(*) As Record_Total From Employer_table UNION ALL
17
11234
by: barkarlo | last post by:
I need help to make grand total time in continuous forms. to calculate total work time I use following formula =format(+1--nz();"short time"). but when I make grand total time in form footer (for all records) my result is error. My grand total must be in format . thanks,
2
16141
by: cr55 | last post by:
I was wondering if anyone can help me with this programming code as i keep getting errors and am not sure how to fix them. The error code displayed now is error: C2228: left of '.rent' must have class/struct/union type.The problem area is underlined. Any help will be greatly appreciated. #include <c:\cpp\input.h> #include < time.h> #define SIZE 20 struct Cust{ int custno; char fname;
1
1568
by: smacky61 | last post by:
How do I summarize a report by finding the totals fees collected for each event and the grand total of all fees. The name of the report is Registered Attendees Report.
0
1741
by: Sport Girl | last post by:
Hello everybody. Please can somebody give me a hand with this issue: How cam I get the Grand Total by row and by column in a Pivot Table in Access 2007. Regards
0
3161
by: Alagas | last post by:
Hi, I'm new to access 2003 & would like to know how to create a report that shows the grand total of counts, details are as the following: 1) I've a database of credit cards where I would like to generate a monthly report for all sales-men & total count of approved cards for each (ex. in AUG). 2) A simple query is created to retreive the required data such as: serial no, sales code & card status(approved only) 2) Then Crosstab query is...
3
3500
by: kkshansid | last post by:
how to get grand total of two years 2001,2002 are fields SELECT sum( 2001 ) AS "2001-2002", sum( 2002 ) AS "2002-2003", ( "2001-2002" + "2002-2003" ) AS "grand total" FROM school this query has error
0
9718
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6876
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.