Comments - LEAD

2 years, 9 months ago Vijay Yande

SELECT AdmissionNo, PatientShiftDate, timestampdiff(DAY, PatientShiftDate, lead(PatientShiftDate, 1 , NOW() ) over ( order by IPDBedAllocationNo) ) as NoofStay FROM PatientBedShift

it is giving error

  1. 42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' curdate() ) over ( order by IPDBedAllocationNo) ) as NoofStay FROM...' at line 5
 
2 years, 9 months ago Ian Gilfillan

LEAD takes an expression and an optional offset. You seem to be adding a third argument - NOW() in the example, or CURDATE() in the error.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.