Your question is a common one. The issue of correlation is covered in depth in a couple of sources. First, this exact situation of pulling a value from a returned ODBC query is covered as an integral part of the LoadRunner ODBC training delivered by Mercury.
If you have not had an opportunity to take advantage of the available Mercury training, then this exact situation is covered in Mercury's Product Documentation. Take a look at the LoadRunner Creating VUser Scripts Guide. The Appropriate Chapter covers the creation of Database Virtual User Scripts, particularly the issue of Correlation. You might also use the online help in the Virtual User generator for shorthand information on correlation functions for ODBC virtual users.