Unix Technical Forum

select 3 values from one table to return in one rs

This is a discussion on select 3 values from one table to return in one rs within the SQL Server forums, part of the Microsoft SQL Server category; --> I am having trouble accessing a table and am seeking out some advise on how to do it. I ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:35 PM
steve stevo
 
Posts: n/a
Default select 3 values from one table to return in one rs

I am having trouble accessing a table and am seeking out some advise
on how to do it.

I have a select statement that joins several tables and everything
works ok , however I want to access a further table to retrieve 3 rs
values, so basically I want to retrieve 3 values from the same table -
identifying each by a value in that table.


Any help or pointer would be very welcome.

Simon Christie

strSearch is a dynamically created search string

Copy of select statement below

sql = "SELECT Master.Master_Key,Master.First_App,Original_Info_D ate,Last_Info_Date,Area.Area_Name
AS Area_Name, State_Cntry.State_Cntry_Name, Company.Oper_Name1 AS
Oper_Name1, Company.Oper_Name2 AS Oper_Name2, " _
& " Company.Oper_Name3 AS Oper_Name3, Location.City AS City,
Projects.Project_Name AS Project_Name, " _
& " Expansion.Expansion_Code AS Expansion_Code,
Master.Cap_Size AS cap_size, Cap.Cap_Unit AS Cap_Unit, Master.Cost AS
Cost, " _
& " Master.Status AS Status, Master.Estimated_Year_Completed
AS Estimated_Year_Completed " _
& " FROM Master INNER JOIN " _
& " Area ON Master.Area_Key = Area.Area_Key INNER JOIN " _
& " Company ON Master.Company_Key = Company.Company_Key INNER
JOIN " _
& " Location ON Master.Location_Key = Location.Location_Key
INNER JOIN " _
& " Expansion ON Master.Expansion_Key =
Expansion.Expansion_Key INNER JOIN " _
& " Cap ON Master.Cap_Key = Cap.Cap_Key INNER JOIN " _
& " Projects ON Master.Project_Key = Projects.Project_Key
INNER JOIN " _
& " State_Cntry ON Location.State_Cntry_Key =
State_Cntry.State_Cntry_Key " _
& " WHERE " & strSearch _
& " ORDER BY Area.Area_Key, State_Cntry_Name,Oper_Name1,City"


The table I need to access is called LEC

LEC_Key (PK)
Master_Key - Database Master Key
Company_Key - matches the company
LEC_Type_Key - 3 types per company (values L,E or C)

Each Master Key will have 3 values in the table, one each of L,E and C

Hope this makes some sort of sense

Thanks in advance

Simon Christie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com