I have a below query
SELECT CONVERT(VARCHAR(8),(select TOP 1 LBD=latest_date
FROM some_table
WHERE latest_date < GETDATE()
ORDER BY latest_date DESC), 112) AS [YYYYMMDD]
which will give me a value like 20150324 for example.
Now I have a variable var in Java.
I want var to equal the result of the query (so today, it would be var = 20150324, and tomorrow it could be something completely different).
How would I accomplish this?