How to get sum based on passed (where condition) value
Hi all,
I am having table with empno and jobtitlehours as fields. For each employee, 3 types of jobtitlehours are there. For example, for empno1, he has
consultant(30 hours), programmer(27 hours), Projectleader(40 hours).
I want to sum the the jobtitlehours. I am passing employee number as parameter to procedure, which will return the sum of jobtitlehours for that
employee number.
How to solve this. As for as i know, we cannot pass WHERE condition with GROUP BY clause.
Thanks in advance,
Pal
It is always helpful to provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
Are you looking for something like this?SELECT SUM(consultant + programmer + projectleader)
FROM emp_x
WHERE empno = :p_empno
Similar Messages
-
How to get PERNR based on user ID
Hi All,
How to get PERNR based on userid.
please help me in resolving this.
Thanks for the support.
Regards,
Dhananjaya R Ehope this will help u
DATA: t_pernr LIKE pa0105-pernr,
t_email LIKE pa0105-usrid_long.
STEP 1 - Find personnel number for UNAME
SELECT SINGLE pernr
INTO t_pernr
FROM pa0105
WHERE subty = '0001'
AND endda >= sy-datum
AND begda <= sy-datum
AND usrid = p_uname.
Employee record found*
IF sy-subrc = 0.
STEP 2 - Find email address for personnel number*
SELECT SINGLE usrid_long
INTO t_email
FROM pa0105
WHERE pernr = t_pernr
AND subty = '0022'
AND endda >= sy-datum
AND begda <= sy-datum. -
How to get sum for each currency's in ALV Report
Hi,
A column has amounts with various currency's.
May I know how to get sum quantity for each currency in ALV Report?
Thanks in advance.Hi,
Currency value column should have reference to currency code column.
Regards,
Wojciech -
I bought a movie...verified my payment,but have nooo idea how to get the movie downloaded or where to even find it. did not purchase coud. that ought to be a free feature
Go to Settings>General>Usage. How much space does it show you have?
If you connect your phone to your computer, what does iTunes say is on your phone? Do you see a large amount of "Other"? If so, you may have a corrupted database. You'll need to sync your phone then restore it as NEW (not from back up) then re-sync your data). -
How to get CHARG based on matnr
Hi Experts,
I want to get PO batch(CHARG) based upon matnr.I am using BAPI_PO_GETDETAIL and receiving PO details by providing purchase order number.The line item table there is no field called charg. ..
So How to get Charg based upon matnr
Thanks & Regards
MathiHello,
Get from the table
MCHA - Batches
Regards,
Vasanth -
How to pass where condition to report for condition
hello people ,
i want to pass where condition for the report statement .
for example ,
select ename from emp
i want to pass parameter carry <where deptno=40>
thanksGood Morning oracleuser,
If we understood correctly, Bind references (or bind variables) should use this issue.
a>select ename from emp where deptno= :Dept_Number
If you have any more questions, please post it.
Otherwise:
Mark Helpful or Answer accordingly. -
How to use wildcards in ABAP query where condition?
Hi,
Please tell me how to use wildcards in ABAP qurey where condition.
e.g. select * from mara where matnr = * (wildcard we need to use.
Thanks & Regards,
Gaurav TDo you want to query asterix * ?
select * from mara where matnr = '*'. "then just put it in apstrophes
or you want certain part of string be used as * ?
select * from mara where matnr like '%*' "then use % sign before it
or maybe you want something like this
select * from mara where matnr like '%1' . "then it will look for all materials having '1' inside it
Regards
Marcin -
How to get line item net price and net value?
I have using "BAPI_SALESORDER_SIMULATE" to SIMULATE to create SO,
the return table
ORDER_ITEMS_OUT-NET_VALUE is not equals than created by VA01 .
how to get line item net price and net value?Hi,
Can u elaborate ur query ?
By this FM you cannot create a SO . Use FM --> BAPI_SALESORDER_CREATEFROMDAT2
Regards,
MAdhukar Shetty -
How to get sum amount (wrbtr) from table BSIS group by gjahr hkont monat
Hello! I am new to this forum, and to ABAP. Hope my question is not obvious.
I want to get sum amount from table BSIS, group by year, period an account. Normally I will try a SQL select like this:
SELECT gjahr monat hkont sum( wrbtr ) as wrbtr INTO CORRESPONDING FIELDS OF TABLE itab FROM BSIS WHERE (itabcond) GROUP BY gjahr monat hkont .
The problem is that the amount in field wrbtr is all positive. The result gets wrong. The debet/credit indicator shkzg determines what is positive/negative. How to solve this in the most efficient way? Should I read all accounting documents into an internal table, and loop through them, changing the sign, and then make some new select, or is there a better way?
Regards Dag-Egil
Message was edited by:
Dag-Egil Bull SletholtHere are the objects in the trace list:
SKB1
USR05
TRDIR
SKA1
SKAT
SKB1
BSIS
PRPS
BSAS
V_LTDX
USR02
RFBLG
V_LTDX
LTDX
RTXTH
RTXTF
RTXTT
TRDIR
The most of this call to this tables returns 1-2 records, apart from BSIS, where it returns 10 records. This is the same as accounting documents in the transaction FBL3N. When i try this again with more records returned I still have no call to table GLT0. -
How to get sum of bugs for particular Mnth and particular Year dynamically?
Hi All,
I've a query related to dynamic date and year :
select bug_id,
category,
count(*) Total_bugs,
SUM(CASE when bug_date >= '10/1/2011' and bug_date <= '10/31/2011' Then 1 else 0 end) OCT_11,
SUM(CASE when bug_date >= '9/1/2011' and bug_date<= '9/30/2011' Then 1 else 0 end) SEP_11,
FROM AA_BUG_TBL
GROUP BY BUG_ID,BUG_CATEGORY
In the above query,Can we write one sum statement to get sum of bugs for a particular month and particular year dynamically?
for ex:2 bugs between 10/1/2011 and 10/31/2011 then 2 under oct_11
5 bugs between 09/01/11 and 09/30/2011 then 5 under sep_11
In this case we need to calculate correct no of days for feb
Thanks,
Mahender.So...
You need to iterate based on something like the month, quarter, year... Then query on that. I'll use a "WITH" clause to illustrate:
with my_bugs as
select bug_id
, bug_date
, case when to_char ( bug_date, 'QYYYY' ) = '12009' then 1 else 0 end y2009q1_bug
, case when to_char ( bug_date, 'QYYYY' ) = '22009' then 1 else 0 end y2009q2_bug
, case when to_char ( bug_date, 'QYYYY' ) = '32009' then 1 else 0 end y2009q3_bug
, case when to_char ( bug_date, 'QYYYY' ) = '42009' then 1 else 0 end y2009q4_bug
, case when to_char ( bug_date, 'YYYY' ) = 2009 then 1 else 0 end y2009_bug
, case when to_char ( bug_date, 'YYYY' ) = 2010 then 1 else 0 end y2010_bug
, case when to_char ( bug_date, 'YYYY' ) = 2011 then 1 else 0 end y2011_bug
, case when 1 = 1 then 1 else 0 end is_bug_flag
from bugs
select bug_id
, bug_date
, sum ( y2009q1_bug ) over () as total_bugs_2009q1
, sum ( y2009q2_bug ) over () as total_bugs_2009q2
, sum ( y2009q3_bug ) over () as total_bugs_2009q3
, sum ( y2009q4_bug ) over () as total_bugs_2009q4
, sum ( y2009_bug ) over () as total_bugs_2009
, count (*) over ( partition by is_bug_flag ) as total_bugs
from my_bugsI mocked up some data so my results will be drastically different than yours but here are the results:
BUG_ID BUG_DATE TOTAL_BUGS_2009Q1 TOTAL_BUGS_2009Q2 TOTAL_BUGS_2009Q3 TOTAL_BUGS_2009Q4 TOTAL_BUGS_2009 TOTAL_BUGS
2014 10-SEP-10 0 0 114 1143 1257 10000
2015 14-APR-10 0 0 114 1143 1257 10000
2016 30-NOV-09 0 0 114 1143 1257 10000
2017 03-JUN-11 0 0 114 1143 1257 10000
2018 29-DEC-10 0 0 114 1143 1257 10000
2019 12-JAN-11 0 0 114 1143 1257 10000
2020 21-APR-10 0 0 114 1143 1257 10000
2021 12-JAN-11 0 0 114 1143 1257 10000
2022 29-NOV-10 0 0 114 1143 1257 10000
2023 20-JUL-11 0 0 114 1143 1257 10000
2024 04-MAR-11 0 0 114 1143 1257 10000 -
How to get sum of quantity column in table control
Hi, expert ,
Someone can guide me how to get som of qty column in table control ?
I created a screen with a table control and has a qty quantity field .
I want to show total of qty in a field .
my code like this ...
PROCESS AFTER INPUT.
LOOP AT I_tab.
CHAIN.
FIELD I_tab-COUNTQTY MODULE caculate_total_qty .
endchain.
MODULE UPDATE_TOTAL_QTY .
ENDLOOP.
but, when I Back to the previous screen
It's caculate again so I always get wrong Total quantity .
anyone can help me ...Hi , Dhina
I have another question .
I use internal table data in table control to update database table .
The data in the db will be change ,
but each record I want to delete in table control , it's still exist in database .
my code is
WHEN 'SAVE'
MODIFY YDSGBT53 FROM TABLE I_YDSGBT53 .
COMMIT WORK .
END CASE
How to fix my code and let it can change and delete data in database ?
or
when I delete record in table control I must to delete data in the database too .
Edited by: TitusFang on Jun 16, 2011 3:21 AM -
How to get products based on Material Group 2
Hi all,
I want to find out all the products for a particular "Material Group 2". COMM_PRODUCT table dosent contain the Material Group 2 field. I tried finding in other tables, but couldnt find relation between Material Group 2 and the product.
any hints on how do i proceed ?
Thanks in advance,
RavirajHi Ruth,
Thanks a lot !. This linkage really works !
Full credit to u for that !
Also, I need to get the "Distribution-chain-specific material status" value in CRM. Any hint on this ?
Regards,
Raviraj
Message was edited by: Raviraj Khare -
How to get Item-Code wise stock quantity and value for a previous date
Dear Sir,
As per the government legal requirement , we are required to furnish a list for items having stock as on a date ( date is not the current date but it is some past date) and in the list we need to provide material wise stock quantity and value .
We can generate a list for the current date , but do not know how to get it for a previous date .
We request you to kindly guide us about such a list .
With Thanks and Regards
Sonia Agarwalhi,
might be this reports will be help full for your requirement.
MMBE
MB53
MB52
MB5M
MB5B
MB5T
MBLB
MBBS
MB54
ME56
Thanking you -
How to get the current node element by its value?
e.g,:
wdContext.current<b>Deal</b>Element().setAttributeValue("<i>deal_id</i>","<i>aaaaaaa</i>");
above code can get the result i wanna.
but now i wanna in terms of its node'name to set attribute vaue of itself. in other words,i have no idea about how to get the current node element by its name"<b>Deal</b>".Hi Wing,
The answer is there in your question itself.
wdContext.currentDealElement()
will give you the current node element by its name"Deal" or you could use
wdContext.nodeDeal().getCurrentElement()
or you could use
wdContext.nodeDeal().getElementAt(wdContext.nodeDeal().getLeadSelection())
Regards,
Sudeep -
How to get intimation about DAQmx Physical Channel invalid value encounter
Can anybody tell me that if a DAQmx Control gets value from a configuration file( .ini file ) and the value is invalid (does not exist in the available physical channels list) than how I can be programatically intimated. I couldn't find any property node of DAQmx Physical channel Control which tells about that the current value feeded to the control is invalid.
Thanks Alan, I have got a better soloution from you in another thread launched by me with title "How to get "Browse list of any DAQmx control in array form". In which u suggested of using DAQmx 8.0, which I have downloaded and used the property node DAQmx-Device>>DO.Lines to get an array of all Physical channels(DO category) of all devices. The value taken from that configuration file is searched in Physical channels array and if no match found than the value is invalid.
Maybe you are looking for
-
Template is nested inside itself (directly or indirectly)
Hello helpful folks of the Forum. I had a template (test.dwt) based on which 60 of my pages are built and I dont know what happened now that whenever I try to update, all the editable contents of the 60 pages gets deleted. I was getting an error "
-
I added an HP Deskjet 3420 using the CUPS web configruation. I can only print a test page (which probably means the driver at least is working). However, using lp Untitled\ 1.odt yields no results. It simply addes the job but does not print the one c
-
FileUpload get filename and PATH?
Hi everybody, is there a chance to get also the path from where to upload a file using the fileupload-UI? Thanks a lot Regards Mario
-
How to upload a photo on a Facebook page, NOT in the profile?
Hi, I have the problem to publish an album on a Facebook page, but I'm only capable to publish the album (or the photo) in the profile. Any suggestion? Thanks
-
Helping an older parent develop credit
Hey folks, I'm looking for some advice on how to help my mother develop credit. She is older and doesn't necessarily need it as she works and gets some Social Security, but we both agreed that having her own line of credit (or two) wouldn't be a bad