Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on calculating the sum of a field in a query with join within the Oracle forums, part of the Databases category; Select attend.overtimehours from attendance attend, salarydetail sal where attend.employeeid = sal.employeeid in the above query,how can i fetch the sum of overtimehours? attendance table column_name data_type -------------------- ------------------- attendancerid number ...
|
|||||||
| Oracle Oracle 9i & Oracle 10g Knowledge Base Learn and Share Oracle Technology related articles, white papers, tutorials / study materials, example codes, FAQ's, Tips and Tricks. |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
calculating the sum of a field in a query with join
Select attend.overtimehours from attendance attend, salarydetail sal where attend.employeeid = sal.employeeid
in the above query,how can i fetch the sum of overtimehours? attendance table column_name data_type -------------------- ------------------- attendancerid number employeeid number shiftid number dayofattendance date timein date timeout date numberofhours number overtimehours number presentflag varchar2 salarydetail table column_name data_type ----------------- -------------------- salaryid number employeeid number startdate date enddate date grosssalary number netsalary number overtimeamount number lopamount number paiddays number Last edited by jamesravid; 09-05-2007 at 01:14 PM. |
| Sponsored Links |
|
|||
|
Re: calculating the sum of a field in a query with join
If you need only sum of overtime hours then the following query works for u
Select employeeid,sum(overtimehours ) from attendance group by employeeid If u want bothe sum of overtime and overtime amount then use the following query, Select attend.employeeid, sum(attend.overtimehours),sum(sal.overtimeamount) from attendance attend, salarydetail sal where attend.employeeid = sal.employeeid group by attend.employeeid
__________________
Cheers, :) James:) |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Writing query with LEFT OUTER JOIN | N SRIRAM K | Data Warehousing | 5 | 09-03-2007 06:08 AM |
| Join Query without using NOT IN subquery | Geek_Guest | SQL | 1 | 03-07-2007 04:24 PM |
| Are you Good in Calculating!!!! If so Try this (2) | psuresh1982 | Brainteasers | 3 | 09-13-2006 09:38 AM |
| Are you Good in Calculating!!!! If so Try this | sripri | Brainteasers | 2 | 09-12-2006 03:24 AM |
| Try Calculating | StephenRaj | Brainteasers | 2 | 08-20-2006 01:12 AM |