Home » SQL & PL/SQL » SQL & PL/SQL » Problem:How to supress Duplucate in output
Problem:How to supress Duplucate in output [message #322063] Thu, 22 May 2008 05:34 Go to next message
VEDDETA
Messages: 54
Registered: May 2008
Member
       SELECT  C.LOC_NAME LOCATION,B.DEPT_NAME AS DEPARTMENT,
		     
				COUNT(CASE WHEN(  A.TMS1 > SYSTIMESTAMP - INTERVAL '12' hour )  THEN 1  END)AS "LESS THAN 12 HOUR",
				COUNT(CASE WHEN  A.TMS1 >= SYSTIMESTAMP - INTERVAL '24' hour  AND A.TMS1 <= SYSTIMESTAMP - INTERVAL '12' hour THEN  1  END)AS "12 TO 24 HOUR",
				COUNT(*) AS Total
		FROM  EMP A,DEPT B,LOCATION  C
		WHERE A.DEPT_CD = B.DEPT_CD
		AND A.LOC_CD = C.LOC_CD
		GROUP BY C.LOC_NAME,B.DEPT_NAME
		



I want to supress the duplicate location name in output.How can it be doable with sql query?
Please find below the attached output screenshot and the requirement.
  • Attachment: output.JPG
    (Size: 50.27KB, Downloaded 83 times)

[Updated on: Thu, 22 May 2008 05:51]

Report message to a moderator

Re: Problem:How to supress Duplucate in output [message #322069 is a reply to message #322063] Thu, 22 May 2008 05:49 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Research use of the BREAK SQL*Plus command.
Re: Problem:How to supress Duplucate in output [message #322070 is a reply to message #322069] Thu, 22 May 2008 05:52 Go to previous messageGo to next message
VEDDETA
Messages: 54
Registered: May 2008
Member
Thanks Littlefoot. But can it be doable with sql query?
Re: Problem:How to supress Duplucate in output [message #322071 is a reply to message #322070] Thu, 22 May 2008 06:03 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, Use LAG function.
I precise this has been asked several times in the last couple of weeks and so think you can find it.

Regards
Michel
Re: Problem:How to supress Duplucate in output [message #322093 is a reply to message #322071] Thu, 22 May 2008 08:36 Go to previous messageGo to next message
VEDDETA
Messages: 54
Registered: May 2008
Member
Thanks Michel. But I was unable to find out any related problems here
Re: Problem:How to supress Duplucate in output [message #322107 is a reply to message #322093] Thu, 22 May 2008 09:16 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I used "duplicate break" (the first 2 words that come in mind reading the topic) in the search field and find the answer in the second link.

Can you also find it?

Regards
Michel
Previous Topic: Dynamic sql
Next Topic: partitions in tables
Goto Forum:
  


Current Time: Thu Dec 08 18:10:52 CST 2016

Total time taken to generate the page: 0.10928 seconds