Hi, I have a table that I insert a member's country into every time
someone signs up. What I'd like to do is pull information from the DB
such that I can see each country and the number of users from each.
For example:
Argentina 10
Brazil 5
Canada 3
I'm having trouble writing the SQL for this...any suggestions?
Thanks,
Erik 2 1901
"Erik Lautier" <la*****@gmail. comwrote in message
news:11******** **************@ o5g2000hsb.goog legroups.com...
Hi, I have a table that I insert a member's country into every time
someone signs up. What I'd like to do is pull information from the DB
such that I can see each country and the number of users from each.
For example:
Argentina 10
Brazil 5
Canada 3
W/o schema it's impossible to say what you want for sure but something like
create table membership
(
country varchar(20),
signup varchar(20)
);
insert into membership values ('Argentina', 'member 1')
insert into membership values ('Argentina', 'member 2')
insert into membership values ('Brazil', 'member 1')
insert into membership values ('Brazil', 'member 1')
insert into membership values ('Brazil', 'member 2')
insert into membership values ('Brazil', 'member 3')
insert into membership values ('Canada', 'member 1')
select country, count(signup) from membership group by country
SELECT COUNTRY, COUNT(signup) from membership group by country
>
I'm having trouble writing the SQL for this...any suggestions?
Thanks,
Erik
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
That did the trick. Thanks!
On Apr 22, 8:23 pm, "Greg D. Moore \(Strider\)"
<mooregr_delete t...@greenms.co mwrote:
"Erik Lautier" <laut...@gmail. comwrote in message
news:11******** **************@ o5g2000hsb.goog legroups.com...
Hi, I have a table that I insert a member's country into every time
someone signs up. What I'd like to do is pull information from the DB
such that I can see each country and the number of users from each.
For example:
Argentina 10
Brazil 5
Canada 3
W/o schema it's impossible to say what you want for sure but something like
create table membership
(
country varchar(20),
signup varchar(20)
);
insert into membership values ('Argentina', 'member 1')
insert into membership values ('Argentina', 'member 2')
insert into membership values ('Brazil', 'member 1')
insert into membership values ('Brazil', 'member 1')
insert into membership values ('Brazil', 'member 2')
insert into membership values ('Brazil', 'member 3')
insert into membership values ('Canada', 'member 1')
select country, count(signup) from membership group by country
SELECT COUNTRY, COUNT(signup) from membership group by country
I'm having trouble writing the SQL for this...any suggestions?
Thanks,
Erik
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ling Lee |
last post by:
Hi all.
I'm trying to write a program that:
1) Ask me what file I want to count number of lines in, and then counts the
lines and writes the answear out.
2) I made the first part like this:
in_file = raw_input("What is the name of the file you want to open: ")
in_file = open("test.txt","r")
|
by: Michael |
last post by:
I have this script that works the way I want except for one thing... Once it
hits zero it starts to count up and looks like this:
-1:0-1:0-1:0-18 with the last number counting up.
Can anyone help me find a way to stop it at zero?
Thank you,
Mike
|
by: Cro |
last post by:
Hello Access Developers,
I'd like to know if it is possible to perform a count in an expression
that defines a control source.
My report is based on a query. In my report, I want a text box to
display the number of times a certain value appears in a certain field
(i.e. perform a ‘count'). I will be doing this for many values in many
fields so do not wish to have scores of queries to build my report.
|
by: Noozer |
last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is
enabled, and that the interval is low (4000, which should be 4 seconds). To
ensure the timer wasn't being inadvertantly reset I put some extra code in
the subs that enable and disable the timer. They fire as expected.
To test this I added a second timer with a 1 second interval. The event for
this time would output the enabled status of the first timer and its...
|
by: Fred Morrison |
last post by:
Is it just me or is there something grossly wrong with the Windows Forms
DataGrid control that won't tell me the row count inside it? I'm not
talking about just visible rows (what the heck good is that, pray tell?). I
want the TOTAL rows count in the DataGrid control. Oh sure, there could be
a bound DataTable, DataView, or whatever that can be rextracted; but, that
means my User Interface has to know something about how the data was...
| |
by: rn5a |
last post by:
A SQL Server 2005 stored procedure expects a parameter 'UserID'
depending upon which it retrieves the no. of records & OrderIDs
corresponding to the 'UserID' from a DB table (note that OrderID &
UserID are two of the columns in the DB table). So for e.g. consider a
user whose UserID=6 & the DB table has 3 records whose UserID=6. In
other words, there are 3 OrderID records of the user whose UserID=6,
say, OrderID=8, OrderID=17 & OrderID=29....
|
by: MP |
last post by:
vb6,ado,mdb,win2k
i pass the sql string to the .Execute method on the open connection to
Table_Name(const) db table
fwiw
(the connection opened via class wrapper:)
msConnString = "Data Source=" & msDbFilename
moConn.Properties("Persist Security Info") = False
moConn.ConnectionString = msConnString
moConn.CursorLocation = adUseClient
moConn.Mode = adModeReadWrite' or using default...same result
|
by: Dev |
last post by:
Dear All,
i have get combination of four PHP script for count the visitor of
website but when i apply all these i have no answer.
i am posting the code of all four PHP script below.
CODE OF INDEX.PHP
<?php
print "<font face='verdana' size='1'>";
|
by: jlt206 |
last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below)
I want to place the current number into a variable $MemberNo or into a FormField to be sent via an email function.
But just can't figure it out.
<?
////////////////////////////////////////////////////////////
//
|
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,...
|
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...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |