Solved

Cross tab query...

Posted on 2003-11-18
5
523 Views
Last Modified: 2012-05-04
Hello,

Can anyone help in writing cross tab query in oracle 8i?

Here is the Scenario:

We have two columns timesheet_date, timesheet_hrs.

If the timesheet date is 'Sunday' the value should be shown under the column 'Sunday", if 'Monday' the value should be shown underthe column 'Monday' and so on...

The output will be:

Sunday  Monday  Tuesday  Wednesday  Thursday  Friday  Saturday
8
               8
                              8
                                                8
                                       
Any help is appreciated!

Regards
-Venkitta
0
Comment
Question by:venkitta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
seazodiac earned 50 total points
ID: 9774022
try:

select decode(timesheet_date, 'Sunday', timesheet_hrs) "Sunday",
          decode(timesheet_date, 'Monday', timesheet_hrs) "Monday",
          decode(timesheet_date, 'Tuesday', timesheet_hrs) "Tuesday",
          decode(timesheet_date, 'Wednesday', timesheet_hrs) "Wednesday",
          decode(timesheet_date, 'Thursday', timesheet_hrs) "Thursday",
          decode(timesheet_date, 'Friday', timesheet_hrs) "Friday",
          decode(timesheet_date, 'Saturday', timesheet_hrs) "Saturday"
From <your_table>;
0
 

Author Comment

by:venkitta
ID: 9774055
Thanks a lot. It works.  Appreciate all your help
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9774073
you are very welcome, enjoy being here with you all
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many‚Ķ
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question