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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:24:04+00:00 2026-05-16T10:24:04+00:00

Here is my problem, I have a multilang database shema. First I want a

  • 0

Here is my problem, I have a multilang database shema. First I want a query with this result
French | English
Car | NULL
Etoile | Stars
NULL | Monkey
…

I’m pretty sure I will need to use A left join combinate with Pivot table.
Where I’m suppose to put this query. In a Partial class, or I need to use the Repository Pattern to hold the query.

I Have a lot of multilang table in the database. How can i make a generic query

Languages
LangID PK
LangName nvarchar(100)

Category
CatID Pk
IsActive Bit

CategoryText
CatID FK
CatName nvarchar(200)
LangID Int

  • 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-16T10:24:05+00:00Added an answer on May 16, 2026 at 10:24 am

    It seems like you’re asking several questions, here. First, when you ask where to put the query, that’s really up to the design you’re following. A repository pattern seems like a reasonable idea for data access in a lot of cases, but I’ve no idea if it’s appropriate or not in your case. Are you already using repositories elsewhere, for example?

    Second, are you looking for a working, “generic” query (ie. one that will work for any number of languages) in SQL, or through LINQ?

    If in LINQ, please take a look at the answers to this question. They might be applicable: Pivot data using LINQ

    If in SQL, and assuming you’re using SQL Server, you can indeed perform a pivot either with GROUP BY or, if you’re running a recent version, the PIVOT operator. However, neither case supports a dynamic number of languages – the requested columns for each must be declared explicitly. Like so:

    --GROUP BY
    SELECT ct.CatID,
      MAX(CASE WHEN l.LangName = 'English' THEN ct.CatName END) AS English,
      MAX(CASE WHEN l.LangName = 'French' THEN ct.CatName END) AS French
    FROM CategoryText ct INNER JOIN Languages l ON l.LangID = ct.LangID
    GROUP BY ct.CatID;
    
    --PIVOT
    SELECT ct.CatID, English, French
    FROM CategoryText ct INNER JOIN Languages l ON l.LangID = ct.LangID
      PIVOT(MAX(ct.CatName) FOR l.LangName
        IN([English], [French])) AS P;
    

    Since the Pivot operator doesn’t support a dynamic statement like a subquery in the spreading argument (IN(English, French)), I’m not sure how to handle the generic case. Hopefully this will at least clarify your direction.

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

Sidebar

Related Questions

Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button
Here is the problem I have: I have a lot (tens of thousands) of
Here's my problem: I have a virtual method defined in a .h file that
Here is the problem: we have lots of Javascripts and lots of CSS files,
Here's my problem: I have to call a web service with a secure header
Here's my problem.I have 2 xmlfiles with identical structure, with the second xml containing
Here is the problem: We have all of our development under subversion, but our
Well here's my problem I have three tables; regions, countries, states. Countries can be
I'm struggling here with a problem: I have a controller questions which has action
Here's the problem: 1.) We have page here... www.blah.com/mypage.html 2.) That page requests a

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.