Group Order fetch Times

Source: Internet
Author: User

Original: Group sort fetch count



function Row_number ()

Row_number () over (partition by patient_id/* Columns  to be grouped */  ORDER BY Zyid/* sorted column */)



Sql
SELECT Zyid, patient_id, Row_number () over (partition by patient_id ORDER by Zyid) visit_id from Jk_patient_in_hospita L


Oracle
Create or replace view Adminp_view_info asselect "Zyid", "patient_id", "Mr_no", "Case_no", "NAME", "visit_id", "In_date" From (select A.ipd_no| | + ' _ ' | | Row_number () over (partition by  a.ipd_no  ORDER by A.case_no) as Zyid, a.ipd_no as patient_id, A.mr_no, A.case_no  , b.pat_name as Name, Row_number () over (partition  by A.ipd_no  ORDER by A.case_no) as visit_id  , a.in_date from Oral.adm_inp A,           oral. Sys_patinfo b where A.mr_no=b.mr_no  ) a           where  a.in_date>to_date (' 2013-01-01 ', ' yyyy-mm-dd ');
Keep the number of the source table consistent with the set of conditions to be aware of
where  a.in_date>to_date (' 2013-01-01 ', ' yyyy-mm-dd ')

  

  

Group Order fetch Times

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.