I am now using Microsoft SQL, my code is:
SELECT TOP 1 [avail] FROM [table1] where [name] = \'abc\' order by [datetime] desc
I
If its top 1 you want or remove top command
SELECT TOP 1 isnull([avail],'0') FROM [table1] where [name] = 'abc' order by [datetime] desc