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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:25:22+00:00 2026-06-14T09:25:22+00:00

In my project, I need to write a sql query but I have an

  • 0

In my project, I need to write a sql query but I have an issue.
For example, I have a thousand institutions and I need to test several fields for those institutions, but sometimes some fields don’t exist for an institution so my query discard this institution in the result.
So what I want to do, is to test if yes or not the field exist for this institution and do the condition test if yes or pass the condition if not.

Is there a way to do it simply in the ‘WHERE’ part like something like this :

where if(e.field1 exist) then e.field1='plop1' and if(e.field2 exist) then e.field2='plop2'
  • 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-14T09:25:23+00:00Added an answer on June 14, 2026 at 9:25 am

    You can use the coalesce function for this purpose:

    SELECT COALESCE(e.field1, 'plop1') AS field1 FROM table e
    

    This will replace NULL values for the field with the String ‘plop1’, yielding a not-null result for each record.

    See also http://www.techonthenet.com/oracle/functions/coalesce.php

    EDIT: I’m assuming the field “field1” exists in your database schema. Otherwise, this is an entirely different problem that might have be tackled at the database / application design level.

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

Sidebar

Related Questions

I'm using SQLite in my project and I need to write SQL query to
I have a project wherein i need to write an application for an USRP
I'm working with ASP.NET(VB.NET), SQL 2008 Project. I need to write data to more
I'm working in django project. I have 1 postgresql sql file that need to
In my project I need to write small WYSIWYG editor (just let users make
For a school project i need to write or use a online programming editor.
Here is the problem... For school project I need to write parallel application using
In my project, there is a need to read and write to binary file,
The Junits I have in my project need to load property files from the
We have a WCF service that uses Entity Framework to query a SQL database.

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.