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 7935053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:48:19+00:00 2026-06-03T21:48:19+00:00

How can I join some data from some table whose name is a field

  • 0

How can I join some data from some table whose name is a field of the dataset?

Like this:

SELECT *
FROM dataset
INNER JOIN dataset.table_name 
ON dataset.param_id = (dataset.table_name).id_(dataset.table_name)
  • 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-03T21:48:21+00:00Added an answer on June 3, 2026 at 9:48 pm

    You will have to construct the select statement as a string using T-SQL. Then, use the execute command to run it. For example:

    DECLARE @sql VARCHAR(MAX);
    DECLARE @table_name VARCHAR(100);
    SET @table_name = (SELECT TOP 1 table_name FROM dataset)   ' TODO set criteria correctly here
    SELECT @sql = 'SELECT * FROM dataset INNER JOIN ' & @table_name & ' ON dataset.param_id = ' & @table_name & '.id_' & @table_name & ';'
    EXEC (@sql)
    

    Update

    This is the syntax for Oracle (quoted from Andrewst‘s answer here):

    DECLARE
      TYPE rc_type REF CURSOR;
      rc rc_type;
      table_rec table%ROWTYPE;
    BEGIN
      OPEN rc FOR 'select * from table';
      LOOP
        FETCH rc INTO table_rec;
        EXIT WHEN rc%NOTFOUND;
        -- Process this row, e.g.
        DBMS_OUTPUT.PUT_LINE( 'Name: '||table_rec.name );
      END LOOP;
    END;
    

    http://www.dbforums.com/oracle/718534-ms-sql-exec-equivalent.html

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

Sidebar

Related Questions

I need to acquire some data from a questions table and then LEFT JOIN
I have a table that I need to get some specific data from for
I have three tables, table one (tableA) containing users data like name and email,
I'm having two tables, I need to select some data joined from both of
I'm trying to join some data together from 2 tables, but on several columns.
i have used below linq query to join some table to get accurate data..
Can i join two tables using LINQ for NHibernate like I can do in
How can I join 2 Point3f arrays together? I have tried this but it
I have a set of data from a table ( TableA ) which relates
Im running into this error that I can't work out Im writing some code

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.