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

  • Home
  • SEARCH
  • 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 8141309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:27:43+00:00 2026-06-06T12:27:43+00:00

I have this SQL Query that pulls data from 3 tables. I am unable

  • 0

I have this SQL Query that pulls data from 3 tables. I am unable to get any columns from table3. What might be the issue?

SELECT table1.col1        COUNTRY,
   table2_alias1.col3 STATE,
   table2.GEOG_LOCATION,
   table2.GEOG_LOCATION_pRE,
   table2.T2col4,
   table2.T2col5,
   TABLE3_ALIAS1.ZIP,
   TABLE3_ALIAS1.T3col2,
   TABLE3_ALIAS1.T3col3,
   TABLE3_ALIAS1.T3col4
FROM   table1,
   table2 table2_alias1,
   table2,
   (SELECT *
         FROM   table3
         WHERE  ( col5 = 'XXX'
                   OR col5 = 'YYY' )
                AND col6 = 'ZZZ')TABLE3_ALIAS1
      WHERE  table1.col3 = 'AAA'
              AND table1.col1 = table2_alias1.STATE
              AND table2_alias1.STATE = table2.col7(+)
              AND table2.STATE = TABLE3_ALIAS1.col6(+) 
ORDER BY 
2,
4,
10,
 9

SAMPLE OUTPUT(HIGHLIGHTING THE MOST IMP DATA AS MEANINGFUL COL NAMES)

 COUNTRY|STATE| GEOG_LOCATION   | T2COL2   | T2col3 | t2col4 | zip | T3col2 |T3col4

 USA       CA     LosAngls       LosAngls-1   0        y      90001
 USA       CA     SanFrans       SanFrans-4   0        y      94101
 USA       CA     Freemont       Freemont-A   0        n      94538

Only the first 5 columns have data and the columns INCLUDING zip(that come from table3) and beyond do not contain any data when the query is run

RDBMS

 TABLE1          TABLE2             TABLE3 

 T1_COL1         GEOG_LOCATION          T3_COL1 
 GEOG_LOCATION        T2_COL2       T3_COL2
 T1_COL3         GEOG_LOCATION_pRE      GEOG_LOCATION
 T1_COL4         T2_COL4        T3_COL4
 T1_COL5         T2_COL5        T3_COL5
 T1_COL6         T2_COL6        T3_COL6
 T1_COL7         T2_COL7        T3_COL7
 T1_COL8         T2_COL8        T3_COL8
 T1_COL9         T2_COL9        T3_COL9
 T1_COL10                   T3_COL10

The three tables are linked by the column startihg with HHH. They share then same data. The column starting with FFF(3rd one in table 2) has a recursive relation with the 1st column of table2(HHH_col1).

  • 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-06-06T12:27:45+00:00Added an answer on June 6, 2026 at 12:27 pm

    Try running the nested query on it’s own:

         SELECT *
         FROM   table3
         WHERE  ( col5 = 'XXX'
                   OR col5 = 'YYY' )
                AND col6 = 'ZZZ'
    

    Do you get data back?

    Also, might be worth prefixing the column names in the query above with the table name, just to be safe.

    Then, try joining it to table2:

         SELECT *
         FROM   table3, table2
         WHERE  ( col5 = 'XXX'
                   OR col5 = 'YYY' )
                AND col6 = 'ZZZ'
                AND table2.col3 = table3.col6(+)
    

    … and so on, rebuilding your query one step at a time, until the data is missing. Then you know which step is the culprit…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this query that pulls from my links and votes table and
I have a Google Map that pulls data from Fusion Tables and displays it.
I have a custom SQL query that I run with this line: @avg_score =
I have a SQL query in my ASP.net web app that looks like this:
I have a mysql query that pulls into excel via an ODBC connection. This
I have an SSIS package that exports data from a table on a SQL
Good Day, I have a sql query that returns the following data: EmployeeID...Employee 555..........John
I have this SQL query select case when AllowanceId is null then 2 else
I have this sql query: SELECT S.SEARCH, S.STATUS, C.TITLE AS CategoryName, E.SEARCH_ENGINES AS Engine,
I have this SQL query (in T-SQL): --DECLARE @strTerm varchar(300) --SET @strTerm = 'c'

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.