hello, i need help in my outer join query
i have a 3 tables like:
Table Location
id , Location
1 , T1
2 , T2
3 , T3
4 , T4
5 , T5
Table MeterSN
ID , MeterSN , LocationID
1 , 123456789 , 1
2 ,123456788 , 2
3 , 123456787 , 3
4 , 123456786 , 4
5 , 123456785 , 5
6 , 123456784 , 1
7 , 123456783 , 2
8 , 123456782 , 3
9 , 123456781 ,4
10 ,123456780 , 5
And the Last Table Record
id , RecordedDate , MeterSNID , Reading
1, 27-03-2019, 1, 20
2 , 27-03-2019 , 2 , 20
3 , 27-03-2019 , 3 , 20
4 , 27-03-2019 , 4 , 20
5 , 27-03-2019 , 5 , 20
6 , 28-03-2019 , 6 , 30
7 , 28-03-2019 , 7 , 30
8 , 28-03-2019 , 8 , 30
9 , 28-03-2019 , 9 , 30
10 , 28-03-2019 , 10 , 30
11 , 29-03-2019 , 1 , 40
12 , 29-03-2019 , 2 , 40
13 , 29-03-2019 , 3 , 40
14 ,29-03-2019 , 4 , 40
15 , 29-03-2019 , 5 , 40
Nah I want to show something like this
I want to show all Location with last reading is the value of reading in last date (if last date is not have value then its become 0, example read if there are no record in Table record in 27-03-2000 then 28-03-2000 lastreading should be 0)
and it will read base on newest meterSN in record