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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:03:38+00:00 2026-06-11T01:03:38+00:00

I have a table with 3 columns (containing Integer values that assume only values

  • 0

I have a table with 3 columns (containing Integer values that assume only values from 0 to 10). I want extract, with a single query, a table with 1 column. This column must assume a value based on the following logic:

  1. If one of these three columns has value 0 —-> the value of column of table generated by query must be 0 too.

  2. If none of the last three columns has value 0 —-> the value of column must assume the value 1.

  • 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-11T01:03:40+00:00Added an answer on June 11, 2026 at 1:03 am

    You are looking for CASE construct or IF function:

    SELECT CASE WHEN (t.field1 = 0 OR t.field2 = 0 OR t.field3 = 0) THEN 0
           ELSE 1 END AS value
    FROM t;
    

    In this specific case you might also use the fact that any member being zero will zero the product:

    SELECT CASE WHEN (t.field1*t.field2*t.field3 = 0) THEN 0 ELSE 1 END AS value
    FROM t;
    

    Or

    SELECT IF((t.field1*t.field2*t.field3)=0, 0, 1) AS value FROM t;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table containing two columns in SQL that I want to extract
I have a table containing columns date_trans, time_trans, price. After select query, I want
I have a master table containing 8 columns and I want to select unique
I have a table containing two columns allowable and thickness. The thickness values are
I have a table that contains a number of rows with columns containing a
If i was to have a table with an integer column containing n number
I have a table containing around 100 columns, is it to possible to do
We have a large table (450 million rows containing 34 columns of numeric or
I have a java class containing all the columns of a database table as
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work

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.