SQL Queries
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12074
Printed Date: 30 March 2026 at 4:12am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: SQL Queries
Posted By: zaboss
Subject: SQL Queries
Date Posted: 08 October 2004 at 3:50am
I have a table with: ID, FirstName, LastName, Specialty.... What I need
is to count down how many people are with a specialty and do it in a
single SQL query. I know how to do this with two, but it should be a
better way. That's one problem.
The other one is the same with counting and displaying.
Table 1:
ID, Item, Division
Table 2:
ID, Call, Item.
What I need is to grab all the items belonging to one division from
table 1 and count how many calls were made to 1 item. For this, I'm
clueless. Something like:
Division 1
Item1 - 2 calls
Item2 - 5 calls
Item3 - 6 calls
...
Division 2
Item 1 - 4 calss
...
Thanks.
------------- Cristian Banu
http://www.soft4web.ro - Soft 4 web
|
Replies:
Posted By: michael
Date Posted: 08 October 2004 at 9:13am
As for the first it's simple if you just want to find out what does have a speciality:
Select Count(*) as SpecialPeople from whatevertable where Not Speciality = Null or not speciality = ''
Now as I don't know whether it's null or just blank you can alter that.
Query2 depends whether you do sql server or access, much simpler in sql server......
------------- http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker
|
|