Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> SQL Question

SQL Question

From: <pchapp_at_sapient.com>
Date: 1997/08/27
Message-ID: <872711749.31638@dejanews.com>#1/1

Hi SQL Gurus,

    I have problem in getting the following results. Any help will appreciated. I have a table like

        STOCK_TABLE

	stock_no	dealer_no	received_date

__________ _________ ______________
1000 A111 12-JAN-97 2000 A111 12-JAN-97 3000 A222 13-JAN-97 4000 A333 14-JAN-97 5000 A333 14-JAN-97 I want to find all the stock_no where I received that stock from the
same dealer on the same day more than once. i.e. the result of the above sample data would be
	stock_no	dealer_no	received_date

__________ _________ ______________
1000 A111 12-JAN-97 2000 A111 12-JAN-97 4000 A333 14-JAN-97 5000 A333 14-JAN-97

    By following sql I can get the dealer_no and received_date but not the stock_no.

	SELECT dealear_no, received_date
	FROM stock_table
	GROUP BY dealear_no, received_date
	HAVING count(*) > 1

	this will get

	dealer_no		received_date
	_________		_____________

	A111			12-JAN-97
	A333			14-JAN-97

	Any help will be appreciated.

	Thank you,

Prabha.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Wed Aug 27 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US