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

  • Home
  • SEARCH
  • 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 9086297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:27:16+00:00 2026-06-16T21:27:16+00:00

a couple of queries regarding a database query: So I have the following database

  • 0

a couple of queries regarding a database query:

So I have the following database query, which has a WHERE statement which includes three String variables (rackingSystem, manufacturer, “Amber Risk”).

public Cursor fetchComponentsAndSpecForManufacturer(long inspectionId, String rackingSystem, String manufacturer) {
    Cursor mCursor =
            rmDb.query(true, DAMAGED_COMPONENTS_TABLE, new String[] {
                    DAMAGED_COMPONENT_ID,
                    LOCATION_LINK,
                    RUN_LINK,
                    AREA_LINK,
                    INSPECTION_LINK,
                    LOCATION_REF,
                    RACKING_SYSTEM,
                    COMPONENT,
                    COMPONENT_TYPE,
                    QUANTITY,
                    POSITION,
                    RISK,
                    ACTION_REQUIRED,
                    NOTES_GENERAL,
                    MANUFACTURER,
                    TEXT1,
                    TEXT2,
                    TEXT3,
                    TEXT4,
                    NOTES_SPEC,
                    SPEC_SAVED}, 
                    INSPECTION_LINK + " = " + inspectionId + " AND " + RACKING_SYSTEM + " = ? AND " + MANUFACTURER + " = ? AND " + RISK + " = ? ", 
                    new String[] {rackingSystem, manufacturer, "Amber Risk"},
                    COMPONENT_TYPE + ", " + TEXT1 + ", " + TEXT2 + ", " + TEXT3 + ", " + TEXT4 + ", " + NOTES_SPEC,
                    null, null, null);
    if (mCursor != null) {
        mCursor.moveToFirst();
    }
    return mCursor;
}

Question 1:

How do I search for NULL as, in the above example, manufacturer may be NULL in the database (as the user may not have inputed anything into the database for that bit yet).

Question 2:

Can I include an OR statement in the WHERE statement? So at the moment I am seraching for all records that are “Amber Risk”, but I need to also include in this list entries that are “Red Risk”. If I can do this, how should I edit the WHERE statement?

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

    How do I search for NULL as, in the above example, manufacturer may be NULL in the database

    Use MANUFACTURER + " IS NULL".

    Can I include an OR statement in the WHERE statement?

    Yes. Let’s search for null or empty manufacturers:

    MANUFACTURER + " IS NULL OR " + MANUFACTURER + " = ''"
    

    So at the moment I am seraching for all records that are “Amber Risk”, but I need to also include in this list entries that are “Red Risk”.

    INSPECTION_LINK + " = " + inspectionId + " AND " + RACKING_SYSTEM + " = ? AND " + 
            MANUFACTURER + " IS NULL AND (" + RISK + " = ? OR " + RISK + " = ?)", 
    new String[] {rackingSystem, manufacturer, "Amber Risk", "Red Risk"},
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple of queries regarding the EditText function in Android. First of
A couple of queries regarding the Tomcat manager and admin apps. I have tomcat
I have a couple of queries which pull data for use in a graph.
I have a couple queries which I created 2 separate indexes for, and I
I have a couple of LINQ to SQL queries that I feel take a
I'm using a LINQ to Entities, and I have a couple of queries for
I have a couple of queries for a web site that take a long
I have a couple of queries that run very slowly (several minutes) with the
I have a piece of code below where it performs a couple of queries
I have a database table with a field that has values such as AAAA

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.