MsSQL

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



Go Back   Tutorialized ForumsDatabasesMsSQL

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, 2013, 09:57 AM
Spider Spider is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2013
Posts: 1 Spider User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 9 sec
Reputation Power: 0
Sql Table Query

Hi Ive been given two tables: Employee and Staff

|ID| Name |Surname|Postion| |EmpID|ManID|
---------------------------- -------------
|1 |Scrooge|McDuck |Manager| |3 |1 |
|2 |Daisy |Duck |Manager| |7 |1 |
|3 |Donald |Duck |Support| |6 |2 |
|4 |Minny |Mouse |Support| |4 |2 |
|5 |Mickey |Mouse |Support| |2 |1 |
|6 |Goofy | |Support| |1 |2 |
|7 |Pluto | |Support| |5 |2 |
|8 |Huey |Duck |Support|
|9 |Dewey |Duck |Support|
|10|Louie |Duck |Support|

I am asked for a sql statement that will produce this output

| Name |Surname|Postion|Manager Name|Manager Positon|
-------------------------- --------------------------------
|Donald |Duck |Support|Scrooge |Manager
|Pluto | |Support|Scrooge |Manager
|Goofy | |Support|Daisy |Manager
|Minny |Mouse |Support|Daisy |Manager
|Daisy |Duck |Support|Scrooge |Manager
|Scrooge|McDuck|Manager|Daisy |Manager
|Mickey |Mouse |Manager|Daisy |Manager


So far Ive created a view

CREATE VIEW example
AS
SELECT * FROM Employee
JOIN StaffLink
ON Employee.ID = StaffLink.EmpID

SELECT
GO

Which displays everything but doesnt create the two new columns and doesnt give the names of the managers.

Please guide me.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesMsSQL > Sql Table Query


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 - 2018, Jelsoft Enterprises Ltd.

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