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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:16:57+00:00 2026-05-25T02:16:57+00:00

I need to retrieve a field, only if is not empty: I have a

  • 0

I need to retrieve a field, only if is not empty:

I have a table with: counter(primary),id (this is the same for the same page), text, language and other fields: i have the id and the language.

I need to search the text in that language, and if it’s empty I need the text in english.
example:
– 0,1,hello,eng
– 1,1,ciao,ita

In this case I need to retrieve “ciao”, but if it’s empty I need “hello”.

How can I?

  • 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-25T02:16:58+00:00Added an answer on May 25, 2026 at 2:16 am

    Well, I guess you could just get the Italian (if not empty) and the English and order with Italian first (if any):

    SELECT
        text
    FROM
        <table>
    WHERE
        id = <page-id>
      AND (
          (
            language = '<preferred-language-to-retrieve>'
              AND
            text IS NOT NULL
          )
        OR
          language = '<fallback-language>'
      )
    ORDER BY
        language = '<preferred-language-to-retrieve>' DESC
    LIMIT 1
    

    (untested)

    With substituted values for Italian with English fallback for page ID = 75 (assuming table is named l10n):

    SELECT
        text
    FROM
        l10n
    WHERE
        id = 75
      AND (
          (
            language = 'ita'
              AND
            text IS NOT NULL
          )
        OR
          language = 'eng'
      )
    ORDER BY
        language = 'ita' DESC
    LIMIT 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to retrieve all rows from a table where 2 columns combined are
I need to retrieve a list of the columns in a table in the
I have a table in mnesia and I need to update individual fields in
I need to filter my table so it only uses the minimum amount of
I need to retrieve a record from a database, display it on a web
I need to retrieve a set of Widgets from my data access layer, grouped
I need to retrieve, in my Win32 standalone program, a list of currently installed
I need to retrieve random rows from SQL Server database. I am looking for
I need to retrieve the login ids of the user who is logged onto
I need to retrieve the date from a UIDatePicker (Preferably I would also like

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.