Home » Developer & Programmer » Reports & Discoverer » Select date wise record (merged) (oracle developer suit 10g with xpress edition 10g)
Select date wise record (merged) [message #678622] Sat, 21 December 2019 02:03 Go to next message
shahzaib_4vip@hotmail.com
Messages: 410
Registered: December 2008
Location: karachi
Senior Member
Dear All,

Select code, to_char(to_date(sale_date, 'DD-MM-YYYY'), 'dd') from sale where sale_date = '19-DEC-2019';

TO_CHAR CHASSIS_NO
------- ------------------------------
19 NZE1210300892
19 NZE1210300892

This Query is working fine but i need the date heading as a Month Like

DEC CHASSIS_NO
------- ------------------------------
19 NZE1210300892
19 NZE1210300892

Hope you guys got my question

Regards

Select date wise record [message #678623 is a reply to message #678622] Sat, 21 December 2019 02:03 Go to previous messageGo to next message
shahzaib_4vip@hotmail.com
Messages: 410
Registered: December 2008
Location: karachi
Senior Member
Dear All,

Select code, to_char(to_date(sale_date, 'DD-MM-YYYY'), 'dd') from sale where sale_date = '19-DEC-2019';

TO_CHAR CHASSIS_NO
------- ------------------------------
19 NZE1210300892
19 NZE1210300892

This Query is working fine but i need the date heading as a Month Like

DEC CHASSIS_NO
------- ------------------------------
19 NZE1210300892
19 NZE1210300892

Hope you guys got my question

Regards

Re: Select date wise record (merged) [message #678624 is a reply to message #678622] Sat, 21 December 2019 04:09 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.

Please feedback in your topics when you get help or when someone posts you a question.

Query and output are not consistent.
Please do not fake what you post.
Please post the description of the table.
...

Re: Select date wise record (merged) [message #678625 is a reply to message #678624] Sat, 21 December 2019 04:57 Go to previous messageGo to next message
shahzaib_4vip@hotmail.com
Messages: 410
Registered: December 2008
Location: karachi
Senior Member

SQL> Select  to_char(to_date(sale_date, 'DD-MM-YYYY'), 'dd'),chassis_no from sale where sale_date = '19-DEC-2019';

TO CHASSIS_NO
-- ------------------------------
19 NZE1210300892
19 NZE1210300892
19 GRX1203033724
19 GRX1203033724
19 NCP510172943
19 NCP510172943
19 NCP650002817
19 NCP650002817
19 YF15014976
19 YF15014976
19 ANH208031893
19 ANH208031893
19 ANH208001797
19 ANH208001797
19 ANH208033517
19 ANH208033517
19 MNH100060909
19 ANH150024344
19 ANH150024344
19 ANH100099049
19 NCP600222183

TO CHASSIS_NO
-- ------------------------------
19 NCP600222183
19 M300S0005647
19 SCP905092381
19 KGC100241154
19 NZE1210197543
19 J210G0003269
19 J210G0003269
19 ZZE1220137710
19 NZE1416111543
19 NCP510247196
19 NCZ200075564
19 GX1106072689
19 AZR600131772
19 DA62T314398
19 GX1106053627
19 NCP500098709
19 NZE1419086406
19 S402M0021664
19 ZRR700121457
19 AZR600357602
19 DA63T196205

TO CHASSIS_NO
-- ------------------------------
19 ANH208025611
19 NZE1419091740
19 ZRR700176489
19 AZR603049068
19 AZR603049175
19 ANH100172520_2
19 AZR603050637
19 UCF210089536
19 AZR603097550
19 MCV306033520
19 UCF310065586
19 JZS1750026189
19 SCP100348835
19 SCP110032503
19 ANH208082448
19 GRX1203033724
19 ANH208025611
19 ANH208082448
19 ANH100099049
19 SCP110032503
19 NZE1416111543

63 rows selected.


This is the code so i just need Heading of Month where the date is coming

Regards
Re: Select date wise record (merged) [message #678626 is a reply to message #678625] Sat, 21 December 2019 05:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Just use an alias to your column result.

Re: Select date wise record (merged) [message #678627 is a reply to message #678626] Sat, 21 December 2019 06:50 Go to previous messageGo to next message
shahzaib_4vip@hotmail.com
Messages: 410
Registered: December 2008
Location: karachi
Senior Member
Dear Michel Thanks for your reply as Alias i will add a temporary name

What i need when i select date "19-Dec-2019" The column heading will be Dec
When i Select "15-Oct-2019" The Column heading will be Oct

Hope you get my point of view.

Re: Select date wise record (merged) [message #678628 is a reply to message #678627] Sat, 21 December 2019 07:40 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

This can't be done with (pure) SQL.
You have to do it outside SQL, in your client tool or with PL/SQL.

Previous Topic: Limit workbook to retrieve X rows
Next Topic: Report output to network location
Goto Forum:
  


Current Time: Thu Mar 28 10:32:31 CDT 2024