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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:23:58+00:00 2026-06-03T19:23:58+00:00

I have the following query which runs perfectly well on both Oracle and SQL

  • 0

I have the following query which runs perfectly well on both Oracle and SQL Server 2008 however it doesn’t seem to run on PostgreSQL. The query is intended to return a count of records that match the given criteria. Can someone explain the reason for this and also offer a solution to how this query can be modified to allow it to produce the expected result.

Query:

select count(*) 
from tma_notices 
where TNOT_NOTICE_TYPE ='0400' 
and TNOT_NOTICE_STATUS = 'OK' 
and tnot_notice_id >= 
    (
        select NOTICE_NUM_AT_MIDNIGHT 
        from RWOL_COUNTER_QUERY_TYPE 
        where QUERY_TYPE = 'START_NOTICES_TODAY' 
        and USER_NAME = 'PUBLIC'
    )

UPDATE: This error was caused by unforeseen duplicate records in the PostgreSQL database. Where the duplicates came from needs to be investigated.

  • 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-03T19:24:02+00:00Added an answer on June 3, 2026 at 7:24 pm

    It’s pretty clear that the subquery could return a set of rows and the condition tnot_notice_id >= isn’t valid if compared with a set of rows and not with only a single value.

    Are you sure that exist a unique record that satisfy your where conditions?

    If you want to avoid that behaviour, I suggest you to use tnot_notice_id >= ALL ( subquery )

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

Sidebar

Related Questions

i have the following SQL Query which runs on SQL Server CE 4 SELECT
I have the following query which runs fine on all of my sql server
I have the following oracle query which runs fine SELECT c.customercode, s.sales_id FROM customers
I have created a stored procedure in SQL Server, which runs immediately from Management
I have the following query that runs as part of a CRON job, which
I have a stored procedure running in MS SQL 2008 R2 which runs fine
I have following query which has select query that returns data in 5sec. But
I have following query which take more than a minute to execute, how can
I have the following query which works fine with MySQL but refuses to work
I have the following query which is working fine, but I also want to

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.