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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:46:08+00:00 2026-06-10T21:46:08+00:00

I have a very peculiar problem on my hands. I have a project where

  • 0

I have a very peculiar problem on my hands. I have a project where the previous db engineer didn’t gave a thought on db design and now im stuck with it. My question is simple:

I have two different select queries and one of them should be executed if a field is set or not, i.e.

if field1 is 0 -> execute query 1
if field1 is 1 -> execute query 2

So far i got here:

SELECT should_i_care
FROM 
    product_sample
WHERE
    pid='XXX'
CASE should_i_care
    WHEN '1' then call query2
    WHEN '0' then call query1

But found out that i cant declare the queries i want to run. Any suggestions?

  • 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-10T21:46:10+00:00Added an answer on June 10, 2026 at 9:46 pm

    It should be a script or stored procedure like this

    DECLARE  shouldICare INT; 
    
    SELECT @shouldICare := should_i_care
    FROM 
        product_sample
    WHERE
        pid='XXX';
    
    IF @shouldICare = 1 THEN
       Call query2;
    ELSE
       Call query1;
    END IF;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very peculiar problem. In the VS2010 Server Explorer, I can connect
I am dealing with a very peculiar problem at the moment: I have an
I have a very peculiar problem:(not using web.config) DefaultFacebookApplication dfa=new DefaultFacebookApplication(); dfa.AppId = ...;
I have a very peculiar problem. I understand that while in the foreground the
I have very specific question, I cannot find a problem. I try update some
I have a very peculiar problem across the IE board (ignoring IE6). Basically I
I have a very peculiar problem and my last resort was asking this on
i have very serious problem if any tech expert can help...thank you in advance..
I have very strange problem while I am submitting a practice problem on codechef.
I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now

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.