Home » SQL & PL/SQL » SQL & PL/SQL » display issue
display issue [message #677527] Tue, 24 September 2019 11:20 Go to next message
James1116
Messages: 4
Registered: September 2019
Junior Member
Hi,

I have the following query, I am attaching query result, schema is at the the end of this message.
Basically I want to see duplicate item_description can be displayed together.
do you know how to modify the query ?

Thanks
James

SELECT pdh_item_number,
item_description,
creation_date
FROM xxyh.xxyh_mtl_items_intf_stg
WHERE creation_date BETWEEN To_date('20-aug-2019 00:00:00',
'dd-mon-yyyy hh24:mi:ss')
AND To_date(
'24-sep-2019 23:59:59',
'dd-mon-yyyy hh24:mi:ss')
AND item_description IN (SELECT item_description
FROM xxyh.xxyh_mtl_items_intf_stg
GROUP BY item_description
HAVING Count (item_description) > 1)
ORDER BY creation_date DESC




Name Null? Type
------------------------------ -------- --------------
BATCH_ID NOT NULL NUMBER
RECORD_ID NOT NULL NUMBER
PDH_ITEM_NUMBER VARCHAR2(240)
SUPPLIER VARCHAR2(240)
BRAND VARCHAR2(240)
MASTER_BRAND VARCHAR2(240)
BRAND_FAMILY VARCHAR2(240)
SUB_BRAND VARCHAR2(240)
COUNTRY VARCHAR2(240)
STATE VARCHAR2(240)
ITEM_DESCRIPTION VARCHAR2(240)
ITEM_TYPE VARCHAR2(30)
ITEM_TYPE_CODE VARCHAR2(100)
ITEM_CLASS_CODE VARCHAR2(30)
ITEM_CATALOG_GROUP_ID NUMBER
LAST_UPDATED_BY NUMBER(15)
LAST_UPDATE_DATE DATE
LAST_UPDATE_LOGIN NUMBER(15)
CREATION_DATE DATE
CREATED_BY NUMBER(15)
  • Attachment: query.PNG
    (Size: 30.00KB, Downloaded 282 times)
Re: display issue [message #677528 is a reply to message #677527] Tue, 24 September 2019 12:12 Go to previous messageGo to next message
Michel Cadot
Messages: 67241
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

From your previous topic you did not feedback:

BlackSwan wrote on Tue, 24 September 2019 01:16
...
Welcome to this forum

Please read and follow the forum guidelines, to enable us to help you:
OraFAQ Forum Guide
How to use {code} tags and make your code easier to read
...

BlackSwan wrote on Tue, 24 September 2019 02:14
Consider to actually READ & follow Posting Guidelines

Please read and follow the forum guidelines, to enable us to help you:
OraFAQ Forum Guide
How to use {code} tags and make your code easier to read

EdStevens wrote on Tue, 24 September 2019 13:40
In addition to reading the guidelines...

So once more:
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
If you don't know how to format the code, learn it using SQL Formatter.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
Also always post your Oracle version, with 4 decimals, as solution depends on it.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.



[Updated on: Tue, 24 September 2019 12:13]

Report message to a moderator

Re: display issue [message #677529 is a reply to message #677528] Tue, 24 September 2019 12:32 Go to previous messageGo to next message
James1116
Messages: 4
Registered: September 2019
Junior Member
Guys,
I tried to format SQL query, and copy/paste it to here, that is how my SQL query was displayed..
Re: display issue [message #677530 is a reply to message #677529] Tue, 24 September 2019 13:02 Go to previous messageGo to next message
BlackSwan
Messages: 26722
Registered: January 2009
Location: SoCal
Senior Member
SQL formatted & posted with {code} tags
SELECT pdh_item_number, 
       item_description, 
       creation_date 
FROM   xxyh.xxyh_mtl_items_intf_stg 
WHERE  creation_date BETWEEN To_date('20-aug-2019 00:00:00', 
                             'dd-mon-yyyy hh24:mi:ss') 
                                    AND To_date( 
                                    '24-sep-2019 23:59:59', 
                                        'dd-mon-yyyy hh24:mi:ss') 
       AND item_description IN (SELECT item_description 
                                FROM   xxyh.xxyh_mtl_items_intf_stg 
                                GROUP  BY item_description 
                                HAVING Count (item_description) > 1) 
ORDER  BY creation_date DESC 
Re: display issue [message #677531 is a reply to message #677529] Tue, 24 September 2019 13:20 Go to previous message
Michel Cadot
Messages: 67241
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
James1116 wrote on Tue, 24 September 2019 19:32
Guys,
I tried to format SQL query, and copy/paste it to here, that is how my SQL query was displayed..
Did you read the link we gave you several times?
What about the other points?

Previous Topic: RETURNING clause returns wrong value upon UPDATE statement
Next Topic: co related subquery written in Analytical functions
Goto Forum:
  


Current Time: Mon Jul 13 13:54:31 CDT 2020