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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:01:44+00:00 2026-05-18T20:01:44+00:00

I hope someone will give me an idea how to proceed, because I’m losing

  • 0

I hope someone will give me an idea how to proceed, because I’m losing my mind right now.

I just made two tables in my database. First one looks like this:

categories
categories_id
cat_group (categories group)
cat_name (category name)
cat_lang (category language)

Second one:

users
users_id
username
category

You’ll probably ask yourself why am I using the “categories group”. Well I need sometimes to pull all categories from the database for a certain group. Let’s see an example:

cat_group = teacher
cat_name = teacher
cat_lang = 1 (en)

cat_group = teacher
cat_name = leraar
cat_lang = 2 (dutch)

cat_group = teacher
cat_name = professeur
cat_lang = 3 (french)

When I try to SELECT all teachers now from both tables, it works just fine. But sometimes the category names are the same in different languages.

For example:

Category name: student (english)
category name: student (dutch)
category name: étudiant (french)

When I try the same query:

SELECT users.username, users.category, categories.cat_group 
FROM users
LEFT JOIN categories ON users.category = categories.category_name
WHERE categories.cat_group = 'student'

I end up with the following result:

student adam student
student chris student
étudiant brian student
student adam student
student chris student

I don’t know what I’m doing wrong here. I just need something like:
category_name: student
username: adam
category_group : student

Am I doing anything wrong in my query?

Thanks in advance.

  • 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-18T20:01:44+00:00Added an answer on May 18, 2026 at 8:01 pm

    I do not understand how any of the answers actually fixes your problem. For instance, how are you supposed to determine which language to use ?

    I just need something like … Am I doing anything wrong in my query?

    We need to go back to first principles. The Data model is not ready for coding. When it is, the code will be easy.

    Multiple language support requires a bit more work. The issue is worked around but not dealt with explicitly, and it needs to be. With those two serious issues not being resolved, it is no wonder that you are mentally stressed. And that’s assuming you are reasonably qualified for the task, otherwise you have a third cause of stress.

    You need something like this.

    ▶Normalised Data Model◀ (inline links do not work on some browsers/versions.)

    Readers who are not familiar with the Relational Modelling Standard may find the ▶IDEF1X Notation◀ useful.

    Your examples show a single category per User, so I have provided that; if an User can belong to multiple Categories, you need a different model, let me know.

    Code

    Now your queries are easy. I realise your query is an example, but there is no context, and in a language-specific environment, language is always fairly high up in the order, always part of the context. Here is a query), similar to your example, for all users with Category in their language:

    SELECT  FirstName,
            LastName,
            Name AS Category
        FROM User              U,
             CategoryLanguage  CL
        WHERE U.CategoryId   = CL.CategoryId
        AND   U.LanguageCode = CL.LanguageCode

    Notice there is no need to join with Category. This is because I have used the Identifiers that exist, and migrated them to the child tables, as per the Standard, and not stuck an Id column on everything that moves (in the case of Id columns all over the place, yes, you would have to join with Category; that is eliminated). CategoryId and LanguageCode are exactly that, wherever they show up. No Nulls, no outer joins.

    Here is the same query in your language (let's assume English):

    SELECT  FirstName,
            LastName,
            Name AS Category
        FROM User              U,
             CategoryLanguage  CL
        WHERE U.CategoryId   = CL.CategoryId
        AND   U.LanguageCode = "en"        -- or ${language} from the app layer
        AND   U.CategoryId   = ( SELECT CategoryId 
            FROM  CategoryLanguage 
            WHERE LanguageCode = "en"      -- or ${language} from the app layer
            AND   Name         = "Student" -- or ${category} from the app layer
            )

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

Sidebar

Related Questions

I hope someone will give me an idea how to proceed, because I'm losing
Hope someone will give me a hand with this problem I have. So here
I tried everything to get this code working, and I hope someone will save
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
Hope someone can help me out with this problem I am having. I just
I hope someone can help me here. I'm having trouble loading this variable. Right
Im struggling with some iOS development and I hope someone will be able to
This really, really urks me, so I hope that someone can give me a
hope someone can answer this. Here is some sample code. namespace std { #ifdef
Hope someone could help me with this: I would like to have a column

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.