sql - Group BY with multiple selects (Oracle) -
I'm having trouble using the group with multiple selections. I want to choose the minimum bid offer price for each auction. But I have to get the name of the user who made that bid. As you can see in the results, I get many results for each auction, and if I remove elements from group statements then I get an error message how I can group by ID_Auction and even then the user's Can I show the name? Thanks for the help
select A.ID_AUCTION, Min Price (B.PRICE), one of the U.NAME auctions, Bids B, Users U, Product P Where P. TYPE = 'Coca Cola' --Joins and A.ID_AUCTION = B.ID_AUCTION and BID.ID_USER = U.ID_USER and A.ID_AUCTION, U.NAME by A.ID_PRODUCT = P.ID_PRODUCT Group; ID_AUCTION PRICE NAME ---------- ---------- -------------- ------------- ----------------------------- 27 25 Andrew 28 40 John 27 30 Michael 28 35 Peter < P> Output I wish: ID_AUNAP PRICE NAME ---------- ---------- ---------- - --- ------------------------------------------ 27 25 Andrew 28 35 Peter
SELECT A.ID_AUCTION, MIN (B.PRICE) AS value , U.NAME's auction, bids b, users to u, product p ou P.TYPE = 'coca cola' --Joins and A.ID_AUCTION = B.ID_AUCTION and BID.ID_USER = U.ID_USER and A.ID_PRODUCT = A.ID_AUCTION, U. by P.ID_PRODUCT Group. Perhaps should be like:
select A.ID_AUCTION, U.NAME, B.PRICE from the auction as an internal value ( Join the selection ID_AUCTION, name, bids by order, min 1,2,3 (value)) on the A.ID_AUCTION = b.ID_AUCTION Inner B to join the user B. B. on the U.ID_USER = U.ID_USER on the inside. ID_PRODUCT = P.ID_PRODUCT where the product of P. joining P. A.ID_AUCTION by .YPE = 'coca cola' group, U.NAME I have never seen the way you Get work done, lake This is likely to be an Oracle thing ... I actually think that is considered bad practice in most SQL Arenas ...
Comments
Post a Comment