String type into how the date Date type

In a SQL, if you use rownum and order by, there will be a question of sequencing.

For example, select id1, id2 from t_tablename where rownum <3 order by c_date desc, this statement will start to take before the result set three records, and then these three days recording sorted by date. If the designer on the first date sorting, and then take three days before the record, then you will not get the right results.

So when used with rownum and order by must pay attention to the implementation of the order.

Sentence can be achieved select id1, id2 from (select id1, id2 from t_tablename order by c_date desc) where rownum <3.

 

https://www.cnblogs.com/accumulater/p/6137385.html

 

In a SQL, if you use rownum and order by, there will be a question of sequencing.

For example, select id1, id2 from t_tablename where rownum <3 order by c_date desc, this statement will start to take before the result set three records, and then these three days recording sorted by date. If the designer on the first date sorting, and then take three days before the record, then you will not get the right results.

So when used with rownum and order by must pay attention to the implementation of the order.

Sentence can be achieved select id1, id2 from (select id1, id2 from t_tablename order by c_date desc) where rownum <3.

 

https://www.cnblogs.com/accumulater/p/6137385.html

 

Guess you like

Origin www.cnblogs.com/isme-zjh/p/12203822.html