I am facing such strange problem. Please have a look over the code

```
today_date = Time.now.strftime('%Y-%m-%d')

patient_id = session[:patient_id]

query = QueryContainedModel.find(:first, :conditions => ["query_type = ?", 'appointment_reminder'])

```

This above query generates query\_value in below form ie query\_value

```
query_value = "SELECT PATIENT.NAME AS 'first_name' FROM PATIENT, REMINDER WHERE PATIENT.ID = '#{session[:patient_id]}' 
AND REMINDER.PATIENT_ID = '#{session[:patient_id]}' AND REMINDER.DATE >= '#{today_date}'"

```

But I am unable to fetch values in below code

```
@value = ModelName.find_by_sql "#{query_value}"
@value.each do |value|
  puts value.
end

```