Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get the last non null value of a table coulm

Below is my table and from column B I want to get the value 3 in resultant.

A B
1 1
2 Null
3 2
4 Null
5 3
6 Null
7 Null
8 Null

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Use a LIMIT query:

SELECT *
FROM yourTable
WHERE B IS NOT NULL
ORDER BY A DESC
LIMIT 1;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading