Using data from results of a query

Hello,

I have a query that returns a number and I want to use that number
after that.

Could you please let me know how to access the data.

I fire the query like:

numscens = Progression.find_by_sql(“select numscenarios from
progressions where id = #{params[:progressionid]}”)

How can I access and use the numscenarios returned by the query that
is part of my numscens variable now.

If I do a numscens.to_xml I get:

<?xml version="1.0" encoding="UTF-8"?> 2

Still I cannot figure out how to access that number in numscenarios
tag.

I want to do if (numscens == 1) do this else that…

Apologies for the novice question.

Many Thanks,
Aman