"select count(*)" and "select single *" returns different result
Good day!
product version SAP ECC 6.0
oracle10
data transfers from external oracle db into customer tables using direct oracle db link
sometimes I get case with different results from 2 statements
*mytable has 10 rows
*1st statement
data: cnt type I value 0.
select count( * ) into cnt from mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
*cnt returns 10 - correct
*2nd statement
select single * from mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
*sy-dbcnt returns 0
*sy-subrc returns 4 - incorrect, 10 rows are "invisible"
but
1. se16 shows correct row number
2. I update just one row from "invisible" rows using se16 and 2nd statement returns correct result after that
can not understand why
thank you in advance.
Thank you, Vishal
but,
general problem is that
1. both statements have the same WHERE conditions
2. 1st return resultset with data (sy-dbcnt=10), 2nd return empty dataset, but must return 1 in sy-dbcnt
Yes, different meaning, you are right, but must 2nd must return 1, because of "select single *" construction, not 0.
Dataset to process is the same, WHERE conditions are equal...
I think the problem is that how ABAP interperets select count(*) and "select single *".
Maybe "select count (*)" scans only PK from index page(s)? and "select single *" scans data pages? and something is wrong with that?
I'm new in SAP and didn't find any SAP tool to trace dump of data and indexes pages with Native SQL.
se16 shows all records.
And why after simple manual update of just one record using se16 "select single *" returns 1?
I've just marked one row to update, didn't change any data, then pressed "save".
Similar Messages
-
Select count(*) on sql statement returning zero when a matching row exists.
Our account has an ANSI C application that checks for the existence a row on an Oracle table(s) by using the following SQL:
int iCount = 0;
EXEC SQL
SELECT count(rownum) INTO :iCount
FROM sys.all_tab_columns
WHERE table_name IN
(SELECT table_name FROM
sys.all_synonyms
WHERE upper(synonym_name) = upper(:szDestTable))
AND upper(column_name) = upper(:szColumnName)
AND owner = 'DBAUSER';
The bind variables szDestTable and szColumnName are populated with values parsed from columns on another database table. This application is executed through out the day. Occasionally, the application will report a zero in the iCount when there should be a match. I have verified the szDestTable and szColumnName are populated with the correct values which would find a match and they are correct. To make matters even stranger, the application will parse the same input values and find a match (as it should). At some point during the day, and it can be at any time, the application will NOT find a match on the same file, same values. Every subsequent execution of this application will not find a match on the same values. Once the database is brought down and started up in the evening for its normal backups, the application will find a match again on the same values. This problem does not occur every day. I could be a week or a week and a half between incidents.
I printed the contents of the sqlca.sqqlerrm.sqlerrmc field to a log file. The sqlca.sqlerrm.sqlerrmc field reported an ORA-1405 bind variable was null when the iCount was reporting a zero. When I compiled this application, I set the Proc*C flag to UNSAFE_NULLS=yes since there are other bind variable in the application that can be NULL and that is ok.
The above SQL is compiled into the C application using the Proc*C compiler. It is compiled using the Oracle 11.2.0.2 libraries. The application is executed against an Oracle 11.2.0.2 database. The database and application are executed on an HP/Unix 11.31 platform.
This problem did not start occurring until our account went from Oracle 10.2 to Oracle 11.2. Recently, I have changed the SQL to perform a “SELECT COUNT(rownum)” instead of the “SELECT COUNT(*)”. I compiled the application and executed the new application with the SELECT COUNT(rownum) against the same database where the same application with the SELECT COUNT(*) was failing to find a row that actually existed. The application with the SELECT COUNT(rownum) found the matching row as it should have. The new application has been executing in production for about 10 days now without any problems against ten various Oracle 11.2 databases.
Why would SELECT COUNT(*) and SELECT COUNT(rownum) be any different?This forum is about C programming in general, and about using Studio C in particular.
Your question is about Oracle database programming. You are more likely to find a helpful answer in a forum about database programming. Start here:
https://forums.oracle.com/forums/category.jspa?categoryID=18 -
Returning Different Results Based on Input Criteria
I have a complex nested select statement. Based on selection criteria I want to return different results. Say for instance I had an input parameter Called Products which could contain a Yes/No Flag. If the Flag was Yes then I would want the "top" select, statement to be The following:
Select Product, Time_ID, Amt
From
My Complex Nested Select
But if Product was set to "No", I would want the following:
Select Time_ID, Amt
From
My Complex Nested Select
I know, or course that I can have two COMPLETE set of SQL which are invoked based upon testing the value of the PRODUCT Parameter, but If I duplicate the "inner nested select" then I have 2 sets of select staments to maintain. Is there an alternative to this? Could I make the inner portion which does not change a function of some sort so that my code would look something like this?
Select Product, Time_ID, Amt
From
Execute myNestedSelectFunction
But if Product was set to "No", I would want the following:
Select Time_ID, Amt
From
Execute myNestedSelectFunction
This would atleast ensure that I only have to go one place to maintain the logic of the "static Nested Select" statement.
Just want to make sure I do not have a real viable alternative to "duplicating code"
ThanksHi,
Look in TFM for PIPELINED functions which will allow you to:SELECT Product, Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;
SELECT Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;There are samples if you look on AskTom too.
Regards,
Yoann. -
Select statement returns different results from 9i and 10g
Hi all,
Would appreciate if someone could help to solve this puzzle here:
I have the exact the statements running on Oracle 9i and 10g, why do they return different results?
Select unique(GroupDesc) , GroupSeq from Module where ModuleId in (Select ModuleId from User_Access where UserId='admin') and Status='A'
In Oracle 9i:
Both columns returned as follows...
GroupDesc | GroupSeq
In Oracle 10g:
Only one column returned, the column with unique keyword was missing...
GroupSeq
Could anyone enlighten me?yes, the table structure... actually the CREATE TABLE statement...
with some sample data (INSERT INTO)
and the actual queries (both of them - copy-paste them from each separate environment)
you can use tags around the statements this will format it to a fixed font - making it easier to read
Edited by: Alex Nuijten on Feb 20, 2009 10:05 AM -
Select Count(*) and actual row are differ: 136 rows vs 65k x 7 rows
Dear All,
Good morning. Need your advices. We had a view which is running and producing output to excel files. But recently after one of ours database migration, it were producing differ result: Select Count(*) and actual row are differ: 136 rows vs 65k x 7 rows. Error happen when we export out the row to csv file is produced 65000 rows x 7 worksheep. But when perform select count(*) from RTNEWWIP, result return: 136 rows.
Is there any way to trace below sql to find where go wrong?
The Veiw as below:
CREATE OR REPLACE VIEW RTNEWWIP
(FAB_ID, PO, PRD_NO, SHP_PRD_NO, LOT,
WIP_QTY, ROUTEDESC, IN_TIME, STAY_DAY, BACK_DAY,
WO_FCST_DATE, SHIP_FCST_DATE, SHIP_CONF_DATE, WS_DATE, ROUTERATIO,
PROCESS, LOTSTATUS, LOTTYPE, RETICLEVERSION, PROCESSVERSION,
ROUTESEQUENCE, PRIORITY, PROCESSGEN, PROCESSFAMILY)
AS
select
--ord.order_no,
'SILTERRA' FAB_ID,
wip.PO_NUMBER PO,
wip.FW_DEVICE PRD_NO,
wip.USER_ITEM_DESCRIPTION SHP_PRD_NO,
wip.LOT_ID LOT,
wip.CURR_QTY WIP_QTY,
wip.STEP_DESC ROUTEDESC,
to_char(wip.RECORD_START_DATE,'DD-MON-YYYY HH24:MI:SS') IN_TIME,
to_char((sysdate - wip.RECORD_START_DATE),'9999D99') STAY_DAY,
to_char((wip.SCHEDULED_COMPLETE_DATE - sysdate),'9999D99') BACK_DAY,
-- (sysdate - wip.RECORD_START_DATE) STAY_DAY,
-- (wip.SCHEDULED_COMPLETE_DATE - sysdate) BACK_DAY,
to_char(wip.SCHEDULED_COMPLETE_DATE,'DD-MON-YYYY') WO_FCST_DATE,
to_char((wip.SCHEDULED_COMPLETE_DATE + 1),'DD-MON-YYYY') SHIP_FCST_DATE,
--nvl(oel.attribute15, to_char(sysdate+3650,'DD-MON-YYYY')) SHIP_CONF_DATE,
to_char(nvl(to_date(oel.attribute15,'DD-MON-YYYY'), sysdate+3650),'DD-MON-YYYY') SHIP_CONF_DATE,
to_char(wip.LOT_START_DATE,'DD-MON-YYYY') WS_DATE,
--wip.MASK_NO || '/' || wip.MASK_TOTAL ROUTERATIO,
'''' ||wip.MASK_NO || '/' || wip.MASK_TOTAL ROUTERATIO,
wip.PLAN_NAME_ACTIVE PROCESS,
wip.LOT_STATUS LOTSTATUS,
wip.LOT_TYPE LOTTYPE,
0 RETICLEVERSION,
wip.PLAN_VERSION_ACTIVE PROCESSVERSION,
0 ROUTESEQUENCE,
wip.PRIORITY PRIORITY,
' ' PROCESSGEN,
' ' PROCESSFAMILY
from wip_report wip, lot_fact lf, order_fact orf, order_dim ord,
apps.oe_order_headers_all@prod_myfabetl oeh,
apps.oe_order_lines_all@prod_myfabetl oel
where wip.CUSTNAME like 'Realtek%'
--AND WIP.FW_DEVICE like '%R25C'
and wip.ACTIVE_FACT_KEY = lf.RECORD_KEY
and lf.ORDER_FACT_KEY = orf.RECORD_KEY
and orf.ORDER_KEY = ord.RECORD_KEY
and ord.ORDER_NO = to_char(oeh.order_number)
and oeh.header_id = oel.header_id
and orf.LINE_ITEM_NUMBER = to_char(oel.line_number)
and orf.ITEM_SCHEDULE = to_char(oel.shipment_number)
and wip.LOT_TYPE in ('ENX','PRA','PRD','PRT','CSK','MPW')
union all
select --od.order_no,'
'SILTERRA' FAB_ID,
od.CUST_PO PO,
imd.FW_DEVICE_ID PRD_NO,
nvl(orf.USER_ITEM_DESCRIPTION, nvl(imd.CUST_DEVICE_ID, imd.FW_DEVICE_ID)) SHP_PRD_NO,
sfl.LOTID LOT,
sfl.currentcompqty WIP_QTY,
'CREATED' ROUTEDESC,
to_char(to_date(substr(recordstartdate,1, 14), 'yyyymmddhh24miss'), 'DD-MON-YYYY HH24:MI:SS') IN_TIME,
--sysdate - to_date(substr(recordstartdate,1, 14), 'yyyymmddhh24miss') STAY_DAY,
--to_date(sfl.scheduledcompletedate,'yyyymmdd') - sysdate BACK_DAY,
to_char(sysdate - to_date(substr(recordstartdate,1, 14), 'yyyymmddhh24miss'),'9999D99') STAY_DAY,
to_char(to_date(sfl.scheduledcompletedate,'yyyymmdd') - sysdate,'9999D99')BACK_DAY,
to_char(to_date(sfl.scheduledcompletedate,'yyyymmdd'),'DD-MON-YYYY') WO_FCST_DATE,
to_char(to_date(sfl.scheduledcompletedate,'yyyymmdd') + 1, 'DD-MON-YYYY') SHIP_FCST_DATE,
--nvl(oel.attribute15, to_char(sysdate+3650,'DD-MON-YYYY')) SHIP_CONF_DATE,
to_char(nvl(to_date(oel.attribute15,'DD-MON-YYYY'), sysdate+3650),'DD-MON-YYYY') SHIP_CONF_DATE,
to_char(to_date(sfl.startdate,'yyyymmdd'), 'DD-MON-YYYY') WS_DATE,
' ' ROUTERATIO,
sfl.tempprocessplan PROCESS,
sfl.currentstatus LOTSTATUS,
sfl.currenttype LOTTYPE,
0 RETICLEVERSION,
0 PROCESSVERSION,
0 ROUTESEQUENCE,
' ' PRIORITY,
' ' PROCESSGEN,
' ' PROCESSFAMILY
from SIL_FW_LOTCREATED_VIEW sfl, order_dim od, order_fact orf, item_master_dim imd,
apps.oe_order_headers_all@prod_myfabetl oeh,
apps.oe_order_lines_all@prod_myfabetl oel
where substr(sfl.salesorderno,1,instr(sfl.salesorderno,'-',1,1)-1)= to_char(od.ORDER_NO)
and od.RECORD_KEY = orf.ORDER_KEY
and od.RECORD_CURRENT_FLAG = 1
and orf.RECORD_CURRENT_FLAG =1
and to_char(orf.LINE_ITEM_NUMBER) = substr(sfl.salesorderno,instr(sfl.salesorderno, '-',1,1) +1, (instr(sfl.salesorderno, '.',1,1) -1) - instr(sfl.salesorderno, '-',1,1))
and to_char(orf.ITEM_SCHEDULE) = substr(sfl.salesorderno,instr(sfl.salesorderno, '.',1,1) +1, length(salesorderno) - instr(sfl.salesorderno, '.',1,1))
and orf.ITEM_MASTER_KEY = imd.RECORD_KEY
and sfl.customername = 'Realtek'
and od.ORDER_NO = to_char(oeh.order_number)
and oeh.header_id = oel.header_id
and orf.LINE_ITEM_NUMBER = to_char(oel.line_number)
and orf.ITEM_SCHEDULE = to_char(oel.shipment_number);
select count(*) from rtnewwip;
COUNT(*)
136
1 row selectedquery might be referring to different environment/schema as you are using database link to access some tables.
getting result/count from view means executing query which forms that view. try to run that query separately and see the output.
it may help you to debug -
Dear all;
We have only one Database server with some IIS's as web servers on front . Each web server has own oracle client software in order connect to central database..
The same following query used in C# code returns different results on each IIS server.(3 row, or not data found )
why?
select * from aTable where to_char( adate , 'dd.mm.yyyy' ) = :search_date
regards
Siya1006237 wrote:
If adate is of DATE datatype, it will most likely has the time component. Therefore your SQL below is unlikely to return any data.
select * from aTable where adate = to_date(:search_date, 'dd.mm.yyyy')
Perhaps.....
select * from aTable where TRUNC(adate) = to_date(:search_date, 'dd.mm.yyyy')
Hi,
not having any sample data from you I could not understand that you wanted to select the range 00:00:00 - 23:59:59 on search_date.
Your method might not be efficient if you have an index on adate.
Maybe something like this will be more efficient
select * from aTable
where adate >= to_date(:search_date, 'dd.mm.yyyy')
and adate < to_date(:search_date, 'dd.mm.yyyy') + 1;
If you search_date is 30-Aug-2013 it will get records where adate >= 30-Aug-2013 00:00:00 and adate < 31-Aug-2013 00:00:00, so any time of date 30-Aug-2013.
Try like this and let us know if you still have 2 different results.
Regards.
Alberto -
what is the difference b/w
Select
Endselect
and select into table....
Akshitha..Hi,
When ever u want to append data into the workarea then use select ... endselect. When u r appending data into the internal table then use select. Also when u use select single then also use only select.
Eg: Using only Select
data : begin of itab occurs 0,
lifnr like lfa1-lifnr,
end of itab.
select single lifnr from lfa1 into itab.
data itab like lfa1 occurs 0 with header line.
select * from lfa1 into table itab.
Eg: Using Select .. endselect.
data : itab like lfa1 occurs 0,
wa like lfa1.
select * from lfa1 into wa.
append wa to itab.
endselect.
Regards -
Oracle function and query return different results
Hi, I am using oracle 10g database.
Function is :
create or replace FUNCTION FUNC_FAAL(myCode number,firstDate date
*, secondDate date)*
RETURN INTEGER as
rtr integer;
BEGIN
select count() into rtr*
from myschema.my_table tbl where tbl.myDateColumn between firstDate and
secondDate and tbl.kkct is null and tbl.myNumberColumn = myCode ;
return (rtr);
END FUNC_FAAL;
This function returns 117177 as result.
But if I run same query in the function seperately ;
select count()*
from myschema.my_table tbl
where tbl.myDateColumn between firstDate and secondDate
and tbl.kkct is null and tbl.myNumberColumn = myCode ;
I get different result 11344 (which is the right one).
Table and function are in the same schema.
What can be the problem ?
Thanks.1. i think ur parameter name and Column names are same Firstdate and seconddate try to choose different name
2. try using Trunc function around your dates
where trunc(tbl.myDateColumn) between trunc(firstDate) and trunc(secondDate)then compare the result....sometimes time elements comes into play.
Baig
[My Oracle Blog|http://baigsorcl.blogspot.com/] -
Hi,
I have an odd situation where "select count(*) from my_view where some_clause" returns 0, but the exact same query fetching the data (ie "select * from my_view where some_clause") works fine and fetches, correctly, 4000+ records.
I have tried dropping and recreating the view, and collecting DB stats again, but the problem persists.
I had a look at the explain plans and they are very different, but both the SQL statements work fine on a copy of the database taken with impdp.
Does anyone have any suggestions on what might be going on here ?
Any help would be appreciated, I've run out of ideas !
Dave
Edited by: user10281551 on 18-Sep-2008 00:43
Edited by: user10281551 on 18-Sep-2008 00:44Maybe it's the bug that a function based index is present and gets incorrectly used in the select count(*) statement?
If that's not the case, then please show us more details, like the statement and both execution plans.
Regards,
Rob. -
How to run a select count(*) with multiple rows returned
Hi,
I have to run a select count(*) for different reports.
1) Select count(*) from table
where state = 'CA'
2) Select count(*) from table
where state = 'NY'
3) Select count(*) from table
where state = 'NV'
Instead of running this query again for 50 times, is there a way for me to just put it in one query and get multiple row returns? Thank you.Samantha wrote:
Hi,
I have to run a select count(*) for different reports.
1) Select count(*) from table
where state = 'CA'
2) Select count(*) from table
where state = 'NY'
3) Select count(*) from table
where state = 'NV'
Instead of running this query again for 50 times, is there a way for me to just put it in one query and get multiple row returns? Thank you.select state, count(*) from table group by state order by 1; -
Select count(*) and blank element tags
Is there a way other than column aliases to produce and return an element tag for the following xsql query.
<xsql:query
connection="{@cxn}"
xmlns:xsql="urn:oracle-xsql">
select count(*) from emp
</xsql:query>
Some databases such as SQL Server via a JDBC driver will return a blank column name, thus you'll have an invalid XML document, however SQL Server allows one to use column aliases, such as select count(*) as "count" from emp.
However some databases such as Progress via a JDBC-ODBC bridge and ODBC driver does NOT allow column aliases. Thus I'll always get the following response:
<ERROR>oracle.xml.sql.OracleXMLSQLException: String index out of range: </ERROR>
Question. Can I substitute an element tag when I encounter a blank column name using an action handler? Any ideas? Sample code?
Steve.Please have the data structure as below:
<datastructure>
<GROUP name="G_1" source="Q_TEMP">
<element value="DEPTNO" name="DEPTNO" />
<element value="DNAME" name="DNAME" />
<element value="LOC" name="LOC" />
<GROUP name="G_2" source="Q_TEMP1">
<element value="ENAME" name="ENAME" />
<element value="SAL" name="SAL" />
*</GROUP>*
*<element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />*
*<element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>*
*</GROUP>*
</datastructure>
Aggregate functions to be placed at the level you require it. Here you need at G_1, so place it there. -
Same Query returning different result (Different execution plan)
Hi all,
To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
The query :
SELECT *
FROM schema.table@database a
WHERE column1 IN ('3')
AND column2 = '101'
AND EXISTS
(SELECT null
FROM schema.table2 c
WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
Rows Row Source Operation
0 NESTED LOOPS (cr=31 r=0 w=0 time=4894659 us)
4323 SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
4336 TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
0 REMOTE (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
Rows Row Source Operation
3702 HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
22556 REMOTE (cr=0 r=0 w=0 time=401176 us)
4336 TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
It'is a bug or i have missed somthing ?
PS: The two table are no subject to insert or update statement.
Oracle version : 9.2.0.2.0
System version : HP-UX v1
Thanks.H.Mahmoud wrote:
Oracle version : 9.2.0.2.0
System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version) -
Controls and timecode - same player, different result
I need to look at video clips on-line on a laptop and a PC, both running Windows 7 32 bit and from within Firefox 3.6.3 with Flash 10. But they behave differently even on the same video from the same site. On one (the laptop) the visible screen is larger, there is a black border at the bottom with start/pause/stop controls, and a timecode. On the other (the PC) no border, no controls, no timecode.
How can this be? .
There are minor differences - a few decimal points - in version numbers for Flash 10 (as well as for firefox itself, java and many other apps) but in all cases the PC is the more current.
I've checked for differences in plug-ins, add-ons, default programs. No obvious answer.
Mybe there is some way of setting options within flash player so that it shows things like timecodes?
Advice welcome!!!Select count(*) from (
[code0]
select J_8DG_4JLF.J_8DG_4JLF_DG7.LINE_REF AS "F1" , J_8DG_4JLF.J_8DG_4JLF_DG0.PRIMARY_CARD AS "F2" ,
ROUND ( SUM(Case when J_8DG_4JLF.J_8DG_4JLF_DG0.LINE_INTERNAL_CODE BETWEEN 40 and 59 THEN 1 ELSE 0 END),0) AS "F3" ,
ROUND ( SUM(Case when J_8DG_4JLF.J_8DG_4JLF_DG0.LINE_INTERNAL_CODE BETWEEN 40 and 59 THEN - J_8DG_4JLF.J_8DG_4JLF_DG0.LINE_AMT
ELSE 0 END),0) AS "F4" , Max( J_8DG_4JLF.J_8DG_4JLF_DG0.TXN_DATE) AS "F5"
, Max( nvl(J_8DG_4JLF.J_8DG_4JLF_DG0.CUSTOMER_STAFF_REF,' ')) AS "F6"
from J_8DG_4JLF.J_8DG_4JLF_JT
INNER JOIN J_8DG_4JLF.J_8DG_4JLF_DG7 On J_8DG_4JLF.J_8DG_4JLF_DG7.DG7_ID =J_8DG_4JLF.J_8DG_4JLF_JT.DG7_ID
INNER JOIN J_8DG_4JLF.J_8DG_4JLF_DG0 On J_8DG_4JLF.J_8DG_4JLF_DG0.DG0_ID =J_8DG_4JLF.J_8DG_4JLF_JT.DG0_ID
where ((J_8DG_4JLF.J_8DG_4JLF_DG0.LINE_INTERNAL_CODE in('22','42')) )
group by J_8DG_4JLF.J_8DG_4JLF_DG7.LINE_REF, J_8DG_4JLF.J_8DG_4JLF_DG0.PRIMARY_CARD
having (
ROUND ( SUM(Case when J_8DG_4JLF.J_8DG_4JLF_DG0.LINE_INTERNAL_CODE BETWEEN 40 and 59 THEN 1 ELSE 0 END),0) > 0
AND
ROUND ( SUM(Case when J_8DG_4JLF.J_8DG_4JLF_DG0.LINE_INTERNAL_CODE BETWEEN 20 and 39 THEN 1 ELSE 0 END),0) = 0
[code0]
) t
LINE_INTERNAL_CODE is string -
Same query returning different result set
hi all,
i am using db 10g.
i have a query like below
SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EIH_EFF_DATE
FROM EMP_INC_HEADER,EMP_INC_DETAILS
WHERE EIH_EMP_CODE = EID_EMP_CODE
AND EIH_EFF_DATE = EIH_EFF_DATE
AND EIH_STATUS = 'P'
AND EID_EMP_CODE = '003848'
GROUP BY EID_INCR_CODE,EIH_EFF_DATE
ORDER BY EID_INCR_CODE,EIH_EFF_DATE;which is leading to the output
AMT EID_INCR_CODE EIH_EFF_D
2000 BASIC 21-SEP-10
2000 BASIC 23-SEP-10
2000 BASIC 15-OCT-10
2000 BASIC 21-OCT-10
1200 HTRAN 21-SEP-10
1200 HTRAN 23-SEP-10
1200 HTRAN 15-OCT-10
1200 HTRAN 21-OCT-10
800 OTHERS 21-SEP-10
800 OTHERS 23-SEP-10
800 OTHERS 15-OCT-10
800 OTHERS 21-OCT-10i have query
SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EID_EFF_DATE
FROM EMP_INC_HEADER,EMP_INC_DETAILS
WHERE EIH_EMP_CODE = EID_EMP_CODE
AND EIH_EFF_DATE = EID_EFF_DATE
AND EIH_STATUS = 'P'
AND EID_EMP_CODE = '003848'
GROUP BY EID_INCR_CODE,EID_EFF_DATE
ORDER BY EID_INCR_CODE,EID_EFF_DATE;
leading to
AMT EID_INCR_CODE EID_EFF_D
500 BASIC 21-SEP-10
500 BASIC 23-SEP-10
500 BASIC 15-OCT-10
500 BASIC 21-OCT-10
300 HTRAN 21-SEP-10
300 HTRAN 23-SEP-10
300 HTRAN 15-OCT-10
300 HTRAN 21-OCT-10
200 OTHERS 21-SEP-10
200 OTHERS 23-SEP-10
200 OTHERS 15-OCT-10
200 OTHERS 21-OCT-10
12 rows selected.what second query is returning is correct. as per the table.
but my question what is the difference between my first and second query.
in what way it is different(i am not getting any idea).
if any one is having any clue please share with me.
Thanks..what is the difference between my first and second queryLook like there's no difference.
I think you really meant something like
SELECT SUM(EID_AMOUNT) amt,EID_INCR_CODE,EIH_EFF_DATE
FROM EMP_INC_HEADER EIH,
EMP_INC_DETAILS EID
WHERE EIH.EMP_CODE = EID.EMP_CODE
AND EIH.EFF_DATE = EIH.EFF_DATE
AND EIH.STATUS = 'P'
AND EID.EMP_CODE = '003848'
GROUP BY EID.INCR_CODE,EIH.EFF_DATE
ORDER BY EID.INCR_CODE,EIH.EFF_DATERegards
Etbin -
Difference between standard selection screen and selection screen
hi guyz,
im asking this because in the table D010SINF there are two fields sdate and idate which has different dates in it for some programs and same dates for some..bit confused:(
thankshi BrightSide
standard Selection means
suppose if you are using parameters means system defaultly generate one screen under the Screen Number 1000
Selection Screen means you are creating a screen using
stament SElection-Screen begin of screen 100..
this is the difference whatever the screen other than '1000' is selection Screen, where as 1000 is Standard Selection Screen
Regards
Deva
Maybe you are looking for
-
MacBook Pro (Mid 2010) will only boot in safe mode.
I've been unable to boot my MacBook Pro normally. It will boot in safe mode, and, until today, I was able to get a normal startup after resetting both PRAM and SMC. Running "Repair Disk" on the startup disk did not reveal any problems. I have also do
-
Hi: I am very new to LabView, so I need some help to come up with an idea that can help me save data continuously in real time. Also I don't want the file to be too big, so I would like to crete a new file in every 32 mega bytes, and clear the pre
-
Purchase order No not coming in IW37N
Hi friends , I have created a service PR through PM order and then created PO and then service entry sheet for it. But in Iw37N , its not showing me any value under column "Purchase order No" against that order. What could be the problem . I want to
-
Creating DVD from iPhoto Slideshow with music
I'm trying to create a DVD of a slideshow with music that was created previously in iPhoto and then "Shared with iDVD". The .m4v file located in Pictures> iPhoto Slideshows is not accessible in iDVD. The only way I can make it work is to spend the ho
-
I want to delete a whole line in txt file where i found a string with DATE format.
#The date have specific format mm/dd/yyyy #I Need to find a line where is date older than one year and then erase it $Date = (Get-Date).AddDays(-365) write-host "-----------------------" $a= '\d{2}\/\d{2}\/\d{4}' Select-String -pattern "$a" -Path C