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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:30:52+00:00 2026-06-05T00:30:52+00:00

My SQL query is spitting out 3000 queries when it should be spitting out

  • 0

My SQL query is spitting out 3000 queries when it should be spitting out 20, I’m using Oracle.

Here are the tables:

Item (itemNumber, itemName, itemDescription, itemValue, itemLocation, 
categoryID, sellerUsername)   

Auction (auctionNumber, currency, startDateTime, endDateTime, shippingTerms, 
startBidAmount, reserveAmount, bidIncrementAmount, noOfItems, itemSold, 
itemNumber feedbackDateAndTime, rating, comments, paymentDate, paymentid)

Bid (bidderUsername, auctionNumber, bidDateTime,bidAmount)

and my query

SELECT
   i.itemname,
   i.itemdescription,
   i.itemvalue,
   CASE
       WHEN i.itemnumber=a.itemnumber and a.itemSold='y' THEN 'Sold'
       WHEN a.auctionnumber != b.auctionnumber and TO_CHAR(sysdate,'DD-MON-YY')>endDateTime THEN 'No Bids on that closed auction'
       WHEN TO_CHAR(sysdate,'DD-MON-YY')<a.endDatetime and a.auctionnumber=b.auctionnumber 
                 and reserveamount>(
                 SELECT b.bidAmount
                 FROM dbf12.bid b, dbf12.auction a               
                 WHERE a.auctionnumber=b.auctionnumber 
                 GROUP BY b.bidAmount
                 HAVING b.bidAmount= max(b.bidAmount)) THEN 'No Bids that meets the reserve'
        ELSE 'Auction Still Open'
   END 
FROM 
   dbf12.item i, dbf12.auction a, dbf12.bid b;
  • 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-05T00:30:54+00:00Added an answer on June 5, 2026 at 12:30 am

    It looks like you forgot the join criteria between dbf12.item, dbf12.auction, and dbf12.bid. This makes it essentially a cross product of the three tables, joining every row in each to every row in all the others.

    Try something like this:

    SELECT
       i.itemname,
       i.itemdescription,
       i.itemvalue,
       CASE
           WHEN i.itemnumber=a.itemnumber and a.itemSold='y' THEN 'Sold'
           WHEN a.auctionnumber != b.auctionnumber and TO_CHAR(sysdate,'DD-MON-YY')>endDateTime THEN 'No Bids on that closed auction'
           WHEN TO_CHAR(sysdate,'DD-MON-YY')<a.endDatetime and a.auctionnumber=b.auctionnumber 
                     and reserveamount>(
                     SELECT b.bidAmount
                     FROM dbf12.bid b, dbf12.auction a               
                     WHERE a.auctionnumber=b.auctionnumber 
                     GROUP BY b.bidAmount
                     HAVING b.bidAmount= max(b.bidAmount)) THEN 'No Bids that meets the reserve'
            ELSE 'Auction Still Open'
       END 
    FROM 
       dbf12.item i, dbf12.auction a, dbf12.bid b
        WHERE i.itemnumber = a.itemnumber and b.actionnumber = a.auctionnumber
    

    You can also say something like:

    SELECT
       i.itemname,
       i.itemdescription,
       i.itemvalue,
       CASE
           WHEN i.itemnumber=a.itemnumber and a.itemSold='y' THEN 'Sold'
           WHEN a.auctionnumber != b.auctionnumber and TO_CHAR(sysdate,'DD-MON-YY')>endDateTime THEN 'No Bids on that closed auction'
           WHEN TO_CHAR(sysdate,'DD-MON-YY')<a.endDatetime and a.auctionnumber=b.auctionnumber 
                     and reserveamount>(
                     SELECT b.bidAmount
                     FROM dbf12.bid b, dbf12.auction a               
                     WHERE a.auctionnumber=b.auctionnumber 
                     GROUP BY b.bidAmount
                     HAVING b.bidAmount= max(b.bidAmount)) THEN 'No Bids that meets the reserve'
            ELSE 'Auction Still Open'
       END 
        from db12.item i
            inner join dbf12.auction a on a.itemnumber = i.itemnumber
            inner join dbf12.bid b on b.auctionnumber = a.auctionnumber
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

quick question... my sql query is spitting out this data... Array ( [id] =>
SQL query which select the record from three tables and there is no relation
I have SQL query which joins 3 tables, one being just a many-to-many connecting
My SQL-Query should return a previous record(Claim). Previous means that it has a different
Using classic asp, I am trying to query a SQL Server database like so:
I am using java/hibernate/Oracle. i have a list with more than 3000 entries. if
What SQL query shows me the tables & indexes used by a view on
We have a transact sql statement that queries 4 tables with millions of rows
SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles
my SQL query which works fine is select case month(timestamp_iso(STATUSDATE)) when 1 then 'January'

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.