Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 633443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:11:12+00:00 2026-05-13T20:11:12+00:00

I am extracting data from multiple tables. mt query is as follows: SELECT p.Record_Num

  • 0

I am extracting data from multiple tables. mt query is as follows:

SELECT p.Record_Num as RecordNum
,p.GCD_ID as GCDID
,p.Project_Desc as ProjectDesc
,p.Proponent_Name as ProponentName
,st.Station_Name as StationName
,p.OpCentre as OpCentre
,s.Sector_Name as SectorName
,p.PLZone as PLZone
,f.Feeder_Desc as FeederDesc
,d.DxTx_Desc as DxTx
,op.Op_Control_Desc as OpControl
,t.Type_Desc as Type
,c.Conn_Desc as ConnectionKV
,ss.Status_Desc as Status
,p.MW as MW
,p.Subject as Subject
,p.Ip_Num as IpNum
,p.H1N_ID as H1NID
,p.NOMS_Slip_Num as NomsSlipNum
,p.NMS_Updated as NmsUpdated
,p.Received_Date as ReceivedDate
,p.Actual_IS_Date as ActualISDate
,p.Scheduled_IS_Date as ScheduledIsDate
,stst.Station_Name as UpStation
,ff.Feeder_Desc as UpFeeder
,p.HV_Circuit as HVCircuit
,p.SIA_Required as SIAReqd
FROM Project_Detail p,
Station st, Sector s, Feeder f, DxTx d, Operational_Control op, Type t,
Connection_Kv c, Status ss, Station stst, Feeder ff
WHERE 
p.Station_ID = st.Station_ID and
p.Sector_ID = s.Sector_ID and
p.Feeder = f.Feeder_ID and
p.DxTx_ID = d.DxTx_ID and
p.OpControl_ID = op.Op_Control_ID and 
p.Type_ID= t.Type_ID and
p.ConnKV_ID = c.Conn_ID and
p.Status_ID = ss.Status_ID and
p.UP_Station_ID = stst.Station_ID and
p.UP_Feeder_ID = ff.Feeder_ID

The problem with this query is if it doesnot find an associated value in the second table, it doesnot show the row.
for example : every project has feeders. so if a project_detail table has a feederid which doesnot have an association in the feeder table, then it wont show the row. also, there are times when the feeders are not assigned to a project.

i think i have to use outer joins to get the values. but i cannot figure out how to do that.
please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:11:12+00:00Added an answer on May 13, 2026 at 8:11 pm

    You need LEFT OR FULL OUTER JOINS instead of the inner joins you are now using with your where clause.

    SELECT  p.Record_Num as RecordNum
            ,p.GCD_ID as GCDID
            ,p.Project_Desc as ProjectDesc
            ,p.Proponent_Name as ProponentName
            ,st.Station_Name as StationName
            ,p.OpCentre as OpCentre
            ,s.Sector_Name as SectorName
            ,p.PLZone as PLZone
            ,f.Feeder_Desc as FeederDesc
            ,d.DxTx_Desc as DxTx
            ,op.Op_Control_Desc as OpControl
            ,t.Type_Desc as Type
            ,c.Conn_Desc as ConnectionKV
            ,ss.Status_Desc as Status
            ,p.MW as MW
            ,p.Subject as Subject
            ,p.Ip_Num as IpNum
            ,p.H1N_ID as H1NID
            ,p.NOMS_Slip_Num as NomsSlipNum
            ,p.NMS_Updated as NmsUpdated
            ,p.Received_Date as ReceivedDate
            ,p.Actual_IS_Date as ActualISDate
            ,p.Scheduled_IS_Date as ScheduledIsDate
            ,stst.Station_Name as UpStation
            ,ff.Feeder_Desc as UpFeeder
            ,p.HV_Circuit as HVCircuit
            ,p.SIA_Required as SIAReqd
    FROM    Project_Detail p
            LEFT OUTER JOIN Station st ON p.Station_ID = st.Station_ID
            LEFT OUTER JOIN Sector s ON p.Sector_ID = s.Sector_ID
            LEFT OUTER JOIN Feeder f ON p.Feeder = f.Feeder_ID
            LEFT OUTER JOIN DxTx d ON p.DxTx_ID = d.DxTx_ID
            LEFT OUTER JOIN Operational_Control op ON p.OpControl_ID = op.Op_Control_ID 
            LEFT OUTER JOIN Type t ON p.Type_ID= t.Type_ID
            LEFT OUTER JOIN Connection_Kv c ON p.ConnKV_ID = c.Conn_ID
            LEFT OUTER JOIN Status ss ON p.Status_ID = ss.Status_ID
            LEFT OUTER JOIN Station stst ON p.UP_Station_ID = stst.Station_ID
            LEFT OUTER JOIN Feeder ff ON p.UP_Feeder_ID = ff.Feeder_ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.