SQL Basics

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old December 4th, 2012, 11:11 AM
TEABAG TEABAG is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 TEABAG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 57 sec
Reputation Power: 0
Modifying COUNT(*) statement for multiple tables - Please advise.

I need some advice modifying my existing COUNT(*) statement. I only have a basic knowledge of SQL, any advice would be greatly appreciated.

The COUNT(*) function displays the number of rows with column "attribute_23" populated for each "assignment_number". I am only interested in assignment_numbers with more than one row.
The following query achieves this....

SELECT assignment_number, COUNT(*) number_recs
FROM per_all_assignments_f
WHERE attribute23 IS NOT NULL
GROUP BY assignment_number HAVING COUNT(*) >1


However, I want to add a "name" column from a 2nd table and "department" from a 3rd table to correspond with the assignment_number. person_id can be used to join the tables as it is present in each.

COUNT(*) does not need to be carried out on the additional "name" and "department" columns, i just want to add this information to my current results.
What is the best method of carrying out a COUNT(*) with multiple tables?

Advice would be greatly appreciated. Thanks

Last edited by TEABAG : December 4th, 2012 at 01:41 PM.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > Modifying COUNT(*) statement for multiple tables - Please advise.


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap