I want to know last five transactions or records from emp
table, from now?
Answer Posted / prakash r
Hi,
Please try the below query
Table
------
create table TEMP_SEARCH
(
F1 VARCHAR2(100),
F2 VARCHAR2(100),
F3 VARCHAR2(100)
)
select * from TEMP_SEARCH
Rownum F1 F2 F3
-----------------------------
1 1 500 DES1
2 2 600 DES2
3 3 550 DES3
4 4 760 DES4
5 5 899 DES5
select * from temp_search
minus
(select * from temp_search where rownum < (select count(*) -
2 from temp_search))
This will give the last two transaction
Is This Answer Correct ? | 2 Yes | 7 No |
Post New Answer View All Answers
What does 0 mean in sql?
What is a sql select statement?
How do I run a script in sql developer?
What are the different types of sql commands?
What is sql lookup?
Difference between global and parameter variables?
How to rename a column in the output of sql query?
what are the non-standard sql commands supported by 'mysql'? : Sql dba
How do I add a database to sql?
Which is better cte or subquery?
Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10
How do I run a sql query in pgadmin 4?
Can we use ddl statements in stored procedure sql server?
What is trigger in pl sql with examples?
what is normalization? : Sql dba