I am Stuck With Mysql Query and don't even know if it is possible or not.
I have the Following Table
And I want to Group pstatus
in a way that startdnt column contains the first row value and enddnt contain the last row value of the group. Final result will look like this
so for with this query i'm able to obtain following results
SELECT pstatus,startdnt,enddnt,sum(Datediff(enddnt,startdnt)) as days FROM status GROUP by pstatus ORDER BY startdnt
Please note pstatus (b) may be repeat n
number of times. Thanks in advance..
这个怎么样:
SELECT pstatus,min(startdnt) as StartDate,max(enddnt) as EndDate ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.