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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:53:30+00:00 2026-05-30T13:53:30+00:00

Extending question Fastest way to find not null filed in sqlite I have table

  • 0

Extending question
Fastest way to find not null filed in sqlite

I have table structure

CREATE TABLE IF NOT EXISTS [app_status](
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,
[status] TEXT DEFAULT NULL,
[type] INTEGER
)  

Where type value either can be one or two.
First I want to check if there is no row where type is equal to 1 and having status as not null.

It it fails I want to check if there is no row where type is equal to 2.
For that I have written two sql query.

SELECT 1 
FROM [app_status]
WHERE [status] IS NOT NULL
AND [type]=1

if it doesn’t return any row I fires

SELECT 2 
FROM [app_status]
WHERE [status] IS NOT NULL
AND [type]=2

Is there a way to merge these condition in one query.
Returning one if any row having non null status and type 1 if not returning 2 any row having not null status type 2.
otherwise returning 0 ?

  • 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-30T13:53:32+00:00Added an answer on May 30, 2026 at 1:53 pm

    Why not:

    SELECT COALESCE(min(type), 0)
      FROM app_status
     WHERE status IS NOT NULL
       AND type IN (1,2)
    

    ?

    Do you need all the duplicates?

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

Sidebar

Related Questions

Sorry just clearing my questions. Extending this question Optimizing sqlite query I have a
I have a follow up question to this solution to extending java enums. How
I have a question about extending a custom control which inherits from UserControl. public
I've a question with regard to android adapters. I have a class, extending BaseAdapter.
Extending this question: How to Create several files from a list in a text
Expanding on this question , what is the best way to develop against both
When extending classes, I find it very descriptive to use the base ( MyBase
I'm extending my previous question (Handling exceptions within exception handle) to address my bad
(This is a hypothetical question for discussion, I have no actual problem). Say that
Newbie backbone question: Context: Building a shopping list with backbone I have a model

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.