Getting the Latest Record.
Consider 2 tables TestCases and TestRun
a test Case can have multiple test runs ie. TestCaseId from the Test Case Table will map into N number of Rows in TestRuns table.
I want to do a count of all the test runs which are pass, but as there are multiple entries in TestRun against the testcaseid all the test runs are counted.
what we require is to add up Results against the latest test run.
*The TestRun table has a Run Date field.
Play around with the RANK function:
SELECT RANK("D0 Time"."T00 Calendar Date") saw_0, "D0 Time"."T00 Calendar Date" saw_1, "F2 Units"."2-01 Billed Qty (Sum All)" saw_2 FROM "Sample Sales" WHERE RANK("D0 Time"."T00 Calendar Date") = 1 ORDER BY saw_1 DESC
Regards
John
http://obiee101.blogspot.com/
Similar Messages
-
Formula to get the latest record
Hi,
I looking to have only the last record logged displayed on my report, can any one help me with the formula ?
Sorry,
Actually to be more precise I'm looking to the latest record for each equipment (where there are many records for the equipment during the day).
Many thanks,
Andreia
Edited by: andreia silva on Dec 22, 2009 3:12 PM
Edited by: andreia silva on Dec 22, 2009 3:15 PMHi,
You could use a SQL Expression field. The following example uses the Northwind database (SQL Server) as an example.
Type the following query in the SQL Expression editor
(SELECT MAX("Orders"."OrderDate")
FROM Orders
WHERE CustomerID = Customers.CustomerID)
Then create a record selection formula:
{Orders.OrderDate} = {%datum}
{%datum} is the sql expression
When you run the report, you will see only the last order for each customer -
Reg: Getting the latest or last saved data from the table
Hi,
I'm having a table, which is getting updated whenever something is saved.
Now i want to get the latest or last saved details to be displayed or the details of the row with greatest Id.( i.e, the Id. will be greatest for the last saved)
please help me out with code to do this...
Thanks & Regards,
SureshHi Suresh,
This could be done either through the webdynpro or the back end function module itself.
If another field of type date/time is present in the table, u can save the current date and time along with the data in the table, and sort it in descending order of time. so that whenever u refresh the page the latest record is always in the first row,
if u want to do it through webdynpro, u can also sort the table based on the date so that u get the latest record that was saved.
Another solution is that u can maintain a serial number sort of thing the table which helps u identify the latest record
Hope this helps u.
Regards,
Poojith M V -
How to get only the latest record in a folder
Hi all,
We have an OA SIT that is not a "standard" SIT in that it does not have the traditional Begin and End date. It only has an Effective date. Is there some way I can filter this table to only give me the latest record in the series? I know how to do this in SQL, but don't see how it would be possible in the EUL.
We're trying to avoid creating database views, but at this point, I'm thinking it may be the easiest way to address this. Any other suggestions?
Thanks in advance,
JewellJewell.
Of course I'm not going to mention that I have no idea what a 'standard' SIT is compared to your basic 'non-standard' SIT ... and I have to watch my spelling of such ... but however ...
As you're most likely aware, in SQL you would get all the 'standard' SIT records first by going through the table. Then you'd go back through them all and find the most recent one.
Because of this 2 table pass, I agree that just putting the SQL code in a custom folder (as you're not using views) would make the most sense.
Russ -
Master Child tables how to get the latest rows from both
Hi,
Need some help with the sql. I have two tables Master & Child. In my Master table I have multiple rows for the same record and in the child table also multiple rows for the same master row how can I get the latest one's from both.
For example Data in my Master table looks like
CONT_ID SEQ_NUM DESCRIPTION
1 189 Update 2
1 188 Update 1
1 187 NewNow in the child table for the same CONT_ID I may have the following rows
CONT_ID UPDATED_DATE STATUS
1 3/16/2010 2:19:01.552700 PM P
1 3/16/2010 12:29:01.552700 PM A
1 3/16/2010 12:29:01.552700 PM P
1 3/16/2010 12:19:01.552700 PM NIn my final query how can I get the row with seq_num 189 as it's the latest in Master table and from child table the row with status of P as it's the latest one based on the time. Here is the query i have but it returns the latest row from the child table only and basically repeats the master table rows as opposed to one row that is latest from both:
ThanksHi,
You can use the analytic ROW_NUMKBER function to find the latest row for each cont_id in each table:
WITH got_m_rnum AS
SELECT cont_id, seq_num, description
, ROW_NUMBER () OVER ( PARTITION BY cont_id
ORDER BY seq_num DESC
) AS m_rnum
FROM master_table
-- WHERE ... -- any filtering goes here
, got_c_rnum AS
SELECT cont_id, updated_date, status
, ROW_NUMBER () OVER ( PARTITION BY cont_id
ORDER BY updated_date DESC
) AS c_rnum
FROM child_table
-- WHERE ... -- any filtering goes here
SELECT m.cont_id, m.seq_num, m.description
, c.updated_date, c.status
FROM got_m_rnum m
JOIN got_c_rnum c ON m.cont_id = c.cont_id
AND m.m_rnum = c.c_rnum
AND m.m_rnum = 1
;If you'd like to post CREATE TABLE and INSERT statements for the sample data, then I could test this.
If there happens to be a tie for the latest row (say, there are only two rows in the child_table with a certain cont_id, and both have exactly the same updated_date), then this query will arbitrarily choose one of them as the latest. -
Hi ,
How to find out the latest Record in per_all_people_f and per_all_assignments_f
Requirement : Need to find out the latest record in per_all_people_f and per_all_assignments_f to update the attribute column with pre defined value . Its not possible to track only with person_id / assignment_id and effective end date
SELECT pp_id
FROM (SELECT app.person_id pp_id,
asf.*
FROM apps.per_all_people_f app,
apps.per_all_assignments_f asf
WHERE --app.person_id=123568 and
asf.person_id = app.person_id AND
app.effective_end_date = to_date('31-dec-4712') AND
asf.effective_end_date = to_date('31-dec-4712')
GROUP BY app.person_id)
HAVING COUNT(pp_id) > 1
GROUP BY pp_id
This query also returns more than 1 value for person_id .
It would be great if you put comment on this .. Thanks in advance ,
AryaI am getting more records with asf.primary_flag='Y' . If you give ur mail id , i will send the sample data
ASSIGNMENT_ID EFFECTIVE_START_DATE EFFECTIVE_END_DATE BUSINESS_GROUP_ID RECRUITER_ID GRADE_ID POSITION_ID JOB_ID ASSIGNMENT_STATUS_TYPE_ID PAYROLL_ID LOCATION_ID PERSON_REFERRED_BY_ID SUPERVISOR_ID SPECIAL_CEILING_STEP_ID PERSON_ID RECRUITMENT_ACTIVITY_ID SOURCE_ORGANIZATION_ID ORGANIZATION_ID PEOPLE_GROUP_ID SOFT_CODING_KEYFLEX_ID VACANCY_ID PAY_BASIS_ID ASSIGNMENT_SEQUENCE ASSIGNMENT_TYPE PRIMARY_FLAG APPLICATION_ID ASSIGNMENT_NUMBER CHANGE_REASON COMMENT_ID DATE_PROBATION_END DEFAULT_CODE_COMB_ID EMPLOYMENT_CATEGORY FREQUENCY INTERNAL_ADDRESS_LINE MANAGER_FLAG NORMAL_HOURS PERF_REVIEW_PERIOD PERF_REVIEW_PERIOD_FREQUENCY PERIOD_OF_SERVICE_ID PROBATION_PERIOD PROBATION_UNIT SAL_REVIEW_PERIOD SAL_REVIEW_PERIOD_FREQUENCY SET_OF_BOOKS_ID SOURCE_TYPE TIME_NORMAL_FINISH TIME_NORMAL_START BARGAINING_UNIT_CODE LABOUR_UNION_MEMBER_FLAG HOURLY_SALARIED_CODE REQUEST_ID PROGRAM_APPLICATION_ID PROGRAM_ID PROGRAM_UPDATE_DATE ASS_ATTRIBUTE_CATEGORY ASS_ATTRIBUTE1 ASS_ATTRIBUTE2 ASS_ATTRIBUTE3 ASS_ATTRIBUTE4 ASS_ATTRIBUTE5 ASS_ATTRIBUTE6 ASS_ATTRIBUTE7 ASS_ATTRIBUTE8 ASS_ATTRIBUTE9 ASS_ATTRIBUTE10 ASS_ATTRIBUTE11 ASS_ATTRIBUTE12 ASS_ATTRIBUTE13 ASS_ATTRIBUTE14 ASS_ATTRIBUTE15 ASS_ATTRIBUTE16 ASS_ATTRIBUTE17 ASS_ATTRIBUTE18 ASS_ATTRIBUTE19 ASS_ATTRIBUTE20 ASS_ATTRIBUTE21 ASS_ATTRIBUTE22 ASS_ATTRIBUTE23 ASS_ATTRIBUTE24 ASS_ATTRIBUTE25 ASS_ATTRIBUTE26 ASS_ATTRIBUTE27 ASS_ATTRIBUTE28 ASS_ATTRIBUTE29 ASS_ATTRIBUTE30 LAST_UPDATE_DATE LAST_UPDATED_BY LAST_UPDATE_LOGIN CREATED_BY CREATION_DATE TITLE OBJECT_VERSION_NUMBER
931510 7-Nov-08 31-Dec-12 122 (null) (null) (null) 3978 1 (null) 14402 (null) 220150 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 2 E Y (null) 100035417-2 (null) (null) (null) 45948739 (null) (null) (null) (null) (null) (null) (null) 868007 (null) (null) (null) (null) 449 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)
797386 26-Aug-08 26-Aug-08 122 (null) (null) (null) 3980 3 (null) 14402 (null) 218925 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 1 E Y (null) 100035417 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) 740071 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)
916076 26-Aug-08 31-Dec-12 122 (null) (null) (null) 3980 1 4 14402 (null) 218925 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 1 B Y (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)
797386 25-Feb-08 25-Aug-08 122 (null) (null) (null) 3980 1 (null) 14402 (null) 218925 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 1 E Y (null) 100035417 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) 740071 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) -
[ANN] - Get the latest JDeveloper News Directly in the IDE
Get the RSS News Feed Reader Extension for Oracle JDeveloper 10g from here:
http://otn.oracle.com/products/jdev/htdocs/partners/addins/exchange/RSS/index.html
And you'll get the latest news about JDeveloper first.
Updates on new tips, papers, demos, downloads, extensions and more.
You can also add new channels that you want to monitor.
If you are using another RSS reader add the JDeveloper RSS news feed from:
http://otn.oracle.com/products/jdev/jdeveloper_news.xmlUsually it is a good habit for the serial port to keep all the data that is sent to it. That is "buffered serial port". If you only want some bytes and recent, then you have to take the responsibility of reading every 5 seconds and throwing away the bytes you read and don't want, and keeping only the last. You can have an independent while loop that reads continually and keeps the last n bytes in a shift register. You can also refresh a timestamp every time you read some new bytes to keep a record of how recent the data is.
-
Select the one record with the latest record
I have the following table called tblSales:
SKU TransDate Color
=== ====== ====
123 1/1/2015 Red
123 1/2/2015 Red
123 1/5/2015 Red
123 1/1/2015 White
123 1/2/2015 White
123 1/3/2015 White
123 1/1/2015 Blue
123 1/2/2015 Blue
123 1/5/2015 Blue
I need to create a query along the lines "SELECT the latest record FROM tblSales WHERE Color = 'White''
In this example, the record dated 1/3/2015 would be the result. I know that MAX(TransDate) is used here, but not sure how.
Thanks.
KenKarl,
I had already tried that. It returns all 3 records having SKU = 123 and Color = White.
Worst case scenario is I can always search for White 123s using a query with TransDate DESC and then get the first record. I was just hoping for something a bit more elegant.
Thanks for your help though.
Ken -
How to get the latest Change date and time of a M.O. from View VIAUFKST
Hi All,
I want to get the latest date and time of a M.O. from view
VIAUFKST. I have written the query like this...
SELECT AUFNR
AEDAT " Changed Date
AEZEIT " Changed Time
FROM VIAUFKST
INTO TABLE I_VIAUFKST
WHERE AEDAT >= W_LASTRUN_DATE
ORDER BY AEDAT DESCENDING.
but its not giving me right results... Pls help me out on this or suggest me the right approach to achieve the same...As this is very critical issue...
Advance Thanks and Points Gauranteed...
Suresh> SELECT AUFNR
> AEDAT
> AEZEIT
> FROM VIAUFKST
> INTO TABLE I_VIAUFKST
> WHERE AEDAT >= W_LASTRUN_DATE.
>
> IF NOT I_VIAUFKST[] IS INITIAL.
> SORT I_VIAUFKST BY AEDAT AEZEIT DESCENDING.
> READ TABLE I_VIAUFKST INDEX 1.
> ENDIF.
>
> The above statement is giving me different results...
> such as...
>
> 1. 30/11/2005 19:20:11
> 2. 29/11/2005 22:10:09
> 3. 30/11/2005 20:56:09
> 4. 28/11/2005 23:10:09
>
> by using the above SORT statement i am getting the
> fourth record as the latest, where as it should give
> me the third record....
>
> Please advise,
> Suresh.
Hi Suresh,
The reason why you are getting this result is because the system is interpreting the DESCENDING only for AEZEIT not for both. Change it to
SORT I_VIAUFKST BY AEDAT DESCENDING AEZEIT DESCENDING -
Hello,
I have simple question ....i dont know why i m brain dead today...
I m trying to get the latest date for the each id
with test_data as(
select '001'id, 'xyz'name, '1/1/2009'start_date from dual union all
select '001', 'abc', '1/2/2099' from dual union all
select '001', 'def', '1/3/2009' from dual union all
select '001', 'ghi', '1/4/2009' from dual union all
select '001', 'jkl', '1/5/2009' from dual
The output i m looking for just one record with latest date
with result as
select '001', 'jkl', '1/5/2009' from dual
i tried this
select id,name, greatest(start_date) from test_data
group by id,name,start_date
It gives me output ...which i m not lookg for
with t as
select '001', 'abc', '1/3/2009' from dual union all
select '001', 'ghi', '1/4/2009' from dual union all
select '001', 'jkl', '1/5/2009' from dual
)select * from t
I was wondering if we have any function's in oracle PL/SQL to do these kind of stuff's
Any suggestions is greatly appriciated!! Thank you sio much!!
Edited by: user642297 on Mar 12, 2010 12:21 PMSQL> with test_data as(
2 select '001'id, 'xyz'name, '1/1/2009'start_date from dual union all
3 select '001', 'abc', '1/2/2099' from dual union all
4 select '001', 'def', '1/3/2009' from dual union all
5 select '001', 'ghi', '1/4/2009' from dual union all
6 select '001', 'jkl', '1/5/2009' from dual union all
7 select '002', 'ghi', '1/4/2009' from dual
8 )
9 select id, max(start_date), max(name) keep (dense_rank first order by start_date desc)
10 from test_data
11 group by id;
ID MAX(STAR MAX
001 1/5/2009 jkl
002 1/4/2009 ghiMax
http://oracleitalia.wordpress.com -
Can somebody point me to where I can get the latest Microsoft.SharePoint.ApplicationPages.dll for SharePoint 2010?
When I go into Library Settings on any library or list in SharePoint 2010 I’m getting an unexpected error; I see this in the SharePoint log:
11/18/2014 13:12:26.36 w3wp.exe (0x2260) 0x33EC SharePoint Foundation
Runtime
tkau Unexpected System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks()
at Microsoft.SharePoint.ApplicationPages.ListEditPage.OnLoad(EventArgs e) at ASP._layouts_listedit_aspx.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 03c7c5b4-407f-461c-9cf7-0304eb797b1a
I searched online and found this:
https://social.technet.microsoft.com/Forums/sharepoint/en-US/ed5aa58a-f5cc-4449-8bfd-65ca6f101641/list-settings-page-error-on-all-type-of-sharepoint-2010-listslibraries?forum=sharepointgeneralprevious. It says:
We noticed exactly the same issue after applying some SharePoint updates (SP1 + October 2011 CU). The problem turned out to be that there was an older version (V14.0.4762.1000) of Microsoft.SharePoint.ApplicationPages.dll in the GAC.
This version was being loaded instead of the latest version of the DLL (14.0.6112.5000).
Loading the latest version of Microsoft.SharePoint.ApplicationPages.dll fixed the problem with the List/Library settings page.
I check our Microsoft.SharePoint.ApplicationPages.dll and found that we have version 14.0.6024.1000.
I would like to try replacing it with the latest version to see if that could fix the problem going into library settings.
Does someone know where I can get the latest Microsoft.SharePoint.ApplicationPages.dll for SharePoint 2010?
DavidYou would need to extract it from an update. Pre-SP2 SharePoint 2010 is no longer supported, I'd recommend upgrading to SP2 which should take care of any versioning issues.
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
BEFORE JUST REJECTING MY QUERY, AS A POTENTIALLY NEW CUSTOMER I WOULD APPRECIATE SOME FORM OF AN ANSWER!!
I want to buy an iPad (my first one), but would rather wait a couple of months to get the latest one if they are planning on a release of a newer version later this year. I certainly cannot afford to buy one now and then update when a newer model comes out, especially if it's released only a couple of months from now.The latest one came out just 4 months ago. Doubt one is coming out soon.
There are always going to be people who are one day out of their return period when a new device comes out, and that's just that. No one can predict. And we are all just users here who would have no idea. But I would get an iPad now given the last one came out four months ago. -
In mail how do I get the latest emails to appear at the top of the column automatically. At the moment I have to scroll up from the bottom oldest entires to find my latest mail arrivals
What device are you using?
I assume you are talking about something other than the iPad?
Is there a sort order above the date column? Clicking on this can switch between Ascending and Descending order. -
How to get the last record from the database
I am using MS Access database and Swings as GUI. I want to get the last record of a particular column from the table and store it as a varaible.
Hi
To get Last record of resultset, you have pass some parameter in constructor of CreateStatement.In such case Resultset should be scrollable and Readonly
Example
objStatement=objCon.createStatement ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
mwwResultSet=cwwStatement.executeQuery(mwwSqlQuery);
while(mwwResultSet.next())
if(mwwResultSet.isLast())
//Fetch the required column record.
String abc=mwwResultSet.getString(1);
I think this will work. Try it.
bye -
How to get the last record of an internall table ....
Hi All..
i want to get the last record of an internal table itab, and i want the the value of the last record.Hi,
Use describe statment.
data: lv_line type i.
Describe table itab lines lv_line.
read table itab into wa_itab index lv_line.
regards,
Santosh Thorat
Maybe you are looking for
-
Help as this is all taking up so much space on my computer.
-
0Orgunit(hierarchy) and authorization object display getcell error in Webi
Hello, We are facing with GetCellData error in WebI to SAP BEx Query. This works perfectly fine in Bex for a particular test user who has access to particular org unit value. But in Webi we are getting this Getcelldata erro
-
Exported keynote to quicktime -- how to advance?
Hi, I have a keynote file that is to be played on a windows platform. So it has been successfully exported as mov and got a nice advance forwarding slide control.. I would like to know what if I need to jump back to the previous slide in the mov file
-
Searching LOV is not invoking any method
Hello JHeadstart team: I have the following behaviour with my LOVs generated from JHeadstart (10.1.2) The "Go" button seems to not invoke anything, just give back the same page, not doing any filter. By watching the log window in JDeveloper, seems li
-
SSIS package works on one machine and gives conversion error on other machine
Hi All, I have 150 + packages, I am fetching data from Oracle (11g) and loading in SQL Server. My problem is all the packages works fine on one machine whereas some of the packages give error "cannot convert between unicode and non-unicode string dat