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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:19:01+00:00 2026-06-04T12:19:01+00:00

SELECT Ticket_id FROM Tickets WHERE Status = 1 AND (Ticket_id != ANY(array[1,2,3])) Limit 6

  • 0
SELECT "Ticket_id"  FROM "Tickets"
 WHERE "Status" = 1 AND ("Ticket_id" !=  ANY(array[1,2,3])) Limit 6

And the result is 1,2,3,4,5,6

  • 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-04T12:19:03+00:00Added an answer on June 4, 2026 at 12:19 pm

    You want to use ALL, not ANY. From the fine manual:

    9.21.3. ANY/SOME (array)

    expression operator ANY (array expression)
    

    […] The left-hand expression is evaluated and compared to each element of the array using the given operator, which must yield a Boolean result. The result of ANY is “true” if any true result is obtained.

    So if we say this:

    1 != any(array[1,2])
    

    then we’ll get true since (1 != 1) or (1 != 2) is true. ANY is essentially an OR operator. For example:

    => select id from (values (1),(2),(3)) as t(id) where id != any(array[1,2]);
     id 
    ----
      1
      2
      3
    (3 rows)
    

    If we look at ALL, we see:

    9.21.4. ALL (array)

    expression operator ALL (array expression)
    

    […] The left-hand expression is evaluated and compared to each element of the array using the given operator, which must yield a Boolean result. The result of ALL is “true” if all comparisons yield true…

    so if we say this:

    1 != all(array[1,2])
    

    then we’ll get false since (1 != 1) and (1 != 2) is false and we see that ALL is essentially an AND operator. For example:

    => select id from (values (1),(2),(3)) as t(id) where id != all(array[1,2]);
     id 
    ----
      3
    (1 row)
    

    If you want to exclude all values in an array, use ALL:

    select "Ticket_id"
    from "Tickets"
    where "Status" = 1
      and "Ticket_id" != all(array[1,2,3])
    limit 6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SELECT AVG(variable) AS Expr1, SUM(variable) AS Expr2 FROM ...... result for AVG is 2,
My query is as follows: SELECT ID,Bill_typeID,Cust_ID,Name,Reg_date,Account_Number,Amount,status FROM ( SELECT ID,Bill_typeID,Cust_ID,Name,Reg_date,Account_Number,Amount,status FROM Cust_Bill_Reg_M_Tbl UNION
SELECT * FROM support_systems,tickets INNER JOIN user_access ON tickets.support_system_id = user_access.support_system_id WHERE support_systems.account_id =
I have two tables: article('id', 'ticket_id', 'incoming_time', 'to', 'from', 'message') ticket('id', 'queue_id') where tickets
SELECT events.title FROM events ORDER BY events.title DESC I'm getting the proper ordering for
select @result=@input.query('*') for xml raw,type Above statement will generate following alert: Msg 6819, Level
SELECT sum(TotalHoursM) + (TotalHoursT) + (TotalHoursW) + (TotalHoursTH) + (TotalHoursF) AS TOTAL FROM LeaveRequest
SELECT (SELECT IIF(IsNull(sum(b.AmountCharged) - sum(b.AmountPaid)), a.Balance, (sum(b.AmountCharged) - sum(b.AmountPaid))) FROM tblCurrentTransaction AS b WHERE
SELECT * FROM menu WHERE item_id = 1 OR item_id = 2 OR item_id
SELECT * FROM myTable WHERE field1 LIKE 'match0' AND myfunc(t1.hardwareConfig) LIKE 'match1' Here is

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.