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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:51:07+00:00 2026-05-30T22:51:07+00:00

I have a table tblUser: tblUser and a table tblBCE and data in the

  • 0

I have a table tblUser:

tblUser

enter image description here

and a table tblBCE and data in the given below:

tblBCE

enter image description here

and a master table mstBCE which contains label text to display in front end application. This table contains data for other tab also but currently i want only for tabType ‘BCE’,I will do for other tab myself once i got the concept.

mstBCE

enter image description here

There is no relation between tblBCE and mstBCE tables,we need to follow the top to bottom sequence only.

In front end application i display these data only by sequence i.e.

i follow the sequence of both table to display data like for label “tab display text111111 BCE” comment value should be comments111111 and for label “tab display text222222 BCE” should be “comments22222” etc.

In front end it display as given below for one user:

enter image description here

so the output would be.

Output

enter image description here

Thanks

  • 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-30T22:51:09+00:00Added an answer on May 30, 2026 at 10:51 pm

    My first thought is improve the schema and do you really need to do this.

    To simplify the question it looks like you want to set the column name based on a join to mstBCE.
    You don’t need a relation because the number of columns in tblBCE is fixed. Instead use dynamic sql to set the column names selecting from mstBCE pivoted onto one row.

    DECLARE @sql nvarchar(4000); 
    SELECT @sql = N'SELECT u.[username], u.[department], 
    b.[Option1TB] as [' + pvt.[1] + N'], b.[Option1], 
    b.[Option2TB] as [' + pvt.[2] + N'], b.[Option2], 
    b.[Option3TB] as [' + pvt.[3] + N'], b.[Option3] 
    FROM tblBCE as b 
    JOIN tblUser as u ON b.[UserID] = u.[userid]; ' 
    FROM (
        SELECT [tabconfigid], [tabdata] 
        FROM mstBCE 
        WHERE [tabType] = N'BCE'
    ) as m 
    PIVOT ( MIN(m.[tabdata]) FOR m.[tabconfigid] IN ([1], [2], [3]) ) as pvt; 
    
    EXEC (@sql); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of Users (tblUsers) which contains details of University staff. I
I have created one stored procedure which runs on 5000 users in tbluser table
i have table question (mysql with php) which contains question,category(multiple) and subcat(multiple) its belong.
I have a table that contains intervals: CREATE TABLE tbl ( user_id: INTEGER, start:
I have table rows of data in html being filled from a CGI application.
So I have three tables: CREATE TABLE tblUser ( [pkUserID] [int] IDENTITY(1,1) NOT NULL,
I have a table tbluser with 2 fields: userid = integer (autoincrement) user =
I have table with two SelectOneMenu in row. I need populate data in second
I have table data, select * from tbltaxamount ; id | taxname | taxinfoid
I have table with ajax paging, i can select any page and view data,

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.