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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:22:48+00:00 2026-06-11T06:22:48+00:00

I cannot solve this problem for many hours. This is my table t1: –––––––––––––––––––––––––––––––––––

  • 0

I cannot solve this problem for many hours.
This is my table

t1:

–––––––––––––––––––––––––––––––––––
| id | text   |  lang | transl_id |
–––––––––––––––––––––––––––––––––––
| 1  | first  |  en   |  222      |
–––––––––––––––––––––––––––––––––––
| 2  | second |  de   |  222      |
–––––––––––––––––––––––––––––––––––
| 3  |   jkj  |  de   |  234      |
–––––––––––––––––––––––––––––––––––
| 4  |  89080 |  de   |  235      |
–––––––––––––––––––––––––––––––––––

Here is my query:

SELECT
    transl_id AS property,
    (SELECT text FROM t1 WHERE lang='en') AS value1,
    (SELECT text FROM t1 WHERE lang='de') AS value2,

FROM t1

It returns following table:

–––––––––––––––––––––––––––––––––––
| property  |  value1  |  value2  |
–––––––––––––––––––––––––––––––––––
|    222    |  first   |          |
–––––––––––––––––––––––––––––––––––
|    222    |          |  second  |
–––––––––––––––––––––––––––––––––––
|    234    |  jkj     |          |
–––––––––––––––––––––––––––––––––––
|    235    |  89080   |          |
–––––––––––––––––––––––––––––––––––

Each row has either value1 or value2, never both. Is there a way to group results so that rows with equal values for property field would be in one row? I mean something like this:

–––––––––––––––––––––––––––––––––––
| property  |  value1  |  value2  |
–––––––––––––––––––––––––––––––––––
|    222    |  first   |  second  |
–––––––––––––––––––––––––––––––––––
...
  • 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-11T06:22:49+00:00Added an answer on June 11, 2026 at 6:22 am

    Try this query:

    SELECT
        property,
        max(value1) as Value1,
        max(value2) as Value2
    FROM 
    (
    SELECT transl_id AS property,
        CASE when lang = 'en' then text else null end as value1,
        CASE when lang = 'de' then text else null end as value2
    FROM t1
    ) t
    GROUP BY property
    

    See this SQLFiddle

    Tried adding more values in the table and got the desired result in this SQLFiddle.

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

Sidebar

Related Questions

I've been trying to solve this problem for hours now and i cannot figure
How can I solve this problem Cannot Create Forms. No MDI forms are currently
i need your help badly because i cannot solve this problem on my own.
there's this interesting problem i can not solve myself. I will be very glad,
I am overloading the assignment operator, and am getting this error. Cannot solve it.
This is an easy question, but I cannot seem to solve it. My html
OK so I have an xslt issue that I cannot seem to solve. This
This is probably easy to solve, but the following cannot be done: protected void
This is probably seriously easy to solve for most of you but I cannot
I have a simple problem that i cannot solve. I have a dictionary: aa

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.