+ Reply to Thread
Results 1 to 2 of 2

Thread: merge query

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    31

    merge query

    I have that table structure
    Code:
    CREATE TABLE IF NOT EXISTS [app_status](
    [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,
    [status] TEXT DEFAULT NULL,
    [type] INTEGER
    )
    I can do that :
    Code:
    SELECT 1 
    FROM [app_status]
    WHERE [status] IS NOT NULL
    AND [type]=1
    
    SELECT 2 
    FROM [app_status]
    WHERE [status] IS NOT NULL
    AND [type]=2
    And i want to retrieve the not NULL values , i got 2 types and i want to merge the two queries , how can i do so ?

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    28
    You can try that :
    Code:
    SELECT COALESCE(min(type), 0)
      FROM app_status
     WHERE status IS NOT NULL
       AND type IN (1,2)

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts