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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:34:59+00:00 2026-05-25T10:34:59+00:00

I have a MySQL query that I’m trying to run in SQLite. I found

  • 0

I have a MySQL query that I’m trying to run in SQLite.
I found out that the IF condition isn’t working in SQLite, and should be converted to a CASE.
As the MySQL query is pretty big to have an overview, I was hoping someone can show me how it should be done. In one of many other MySQL queries, I must convert to SQLite.

Once I see how it should be done in a query that I use (because I’m familiar with it), I assume I can handle it for the others.
Here is the MySQL that should run in SQLite:

select 
p.products_model, 
pd.products_name, 
m.manufacturers_name, 
p.products_quantity, 
p.products_weight, 
p.products_image, 
p.products_id, 
p.manufacturers_id, 
p.products_price, 
p.products_tax_class_id, 
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,
IF(s.status, s.specials_new_products_price, p.products_price) as final_price 
from 
products_description pd, 
products p 
left join manufacturers m on p.manufacturers_id = m.manufacturers_id 
left join specials s on p.products_id = s.products_id, 
products_to_categories p2c 
where 
p.products_status = "1" and 
p.products_id = p2c.products_id and 
pd.products_id = p2c.products_id and 
pd.language_id = "1" and 
p2c.categories_id = "10"
  • 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-25T10:35:00+00:00Added an answer on May 25, 2026 at 10:35 am

    Change:

    IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,
    IF(s.status, s.specials_new_products_price, p.products_price) as final_price 
    

    to

    CASE
        WHEN s.status <> 0 AND s.status IS NOT NULL
        THEN s.specials_new_products_price
        ELSE NULL
    END AS specials_new_products_price,
    CASE
        WHEN s.status <> 0 AND s.status IS NOT NULL
        THEN s.specials_new_products_price
        ELSE p.products_price
    END AS final_price
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using in C# MYsql .I have query that works if I run
i've a MySQL query that should return some rows that have the letters Ö
I have the following MySQL query that I'm trying to translate into an equivalent
I have a MySQL query that is trying to get all the Pages that
I have a mysql table like that and i need to run a query
I have a mysql query that is trying to combine the following tables: TABLE:
I have this mysql query that I am trying to analyze. It is very
I have a MySql query that take a very long time to run (about
I have a mysql query that's taking several minutes which isn't very good as
I have a MySQL query that returns a result with a single column of

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.