SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

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 ASP Free Forums Sponsor:
  #1  
Old January 14th, 2005, 05:11 PM
twopecker twopecker is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 148 twopecker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 48 m 59 sec
Reputation Power: 5
Struggling w/ SQL statement...not sure if its possible

I have 3 tables:

employees, skills and employee_skills

The employees table has the following columns:
emp_name
emp_id

the skills table has the following columns:
skill_id
skill_name

the emp_skills table has the following columns:
emp_id
skill_id
skill_level

This is from a database that keeps info about call types (skills) for analyst in a center. I am trying to create view that has a column for the emp_name and a column for each skill name. I cant for the life of me get this to work...anyone provide any help?

Example of what I want

EMP NAME skill1 skill2 skill3
Marcus 2 3 7
Jim 9 4 3

Reply With Quote
  #2  
Old January 14th, 2005, 05:21 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,879 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 18 h
Reputation Power: 500
Without seeing any sample data, this is the best I can do.
Code:
SELECT A.EmpName,
	C.SkillName
FROM Employees As A 
INNER JOIN EmployeeSkills As B On (A.EmpID = B.EmpID)
INNER JOIN Skills As C On (B.SkillID = C.SkillID)
ORDER BY A.EmpName

Reply With Quote
  #3  
Old January 14th, 2005, 05:34 PM
twopecker twopecker is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 148 twopecker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 48 m 59 sec
Reputation Power: 5
If i just made a real quick sample access db, would this work?

Reply With Quote
  #4  
Old January 14th, 2005, 05:42 PM
twopecker twopecker is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 148 twopecker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 48 m 59 sec
Reputation Power: 5
Quote:
Originally Posted by twopecker
If i just made a real quick sample access db, would this work?


http://www.noworkethic.com/skills.mdb

I just tossed up a real quick example set of data.

Reply With Quote
  #5  
Old January 14th, 2005, 05:51 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,879 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 18 h
Reputation Power: 500
try this
Attached Files
File Type: zip skills.zip (11.7 KB, 133 views)

Reply With Quote
  #6  
Old January 17th, 2005, 10:11 AM
twopecker twopecker is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 148 twopecker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 48 m 59 sec
Reputation Power: 5
memnoch -

thanks for the help.

that's what i was able to get, but not what I am looking for.

What i would like the query to return for the columns in the table is a column for emp_name from the employees table, and a column each for each of the values of skill_name in the skill table. So a column for emp_name, a column for "basic", a column for "medium" and a column for "advanced".

The data in each row would need to be the value of emp_name from employees, and the value for skill_level from the emp_skills table for each of the skill_name columns.

thanks!

Reply With Quote
  #7  
Old January 18th, 2005, 10:33 AM
twopecker twopecker is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 148 twopecker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 48 m 59 sec
Reputation Power: 5
anyone else have any input?

Reply With Quote
  #8  
Old January 19th, 2005, 05:56 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
See Attached

You can do this, but there are limiations as you will find out

S-
Attached Files
File Type: zip skills.zip (18.2 KB, 194 views)

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Struggling w/ SQL statement...not sure if its possible


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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT