:select

Hi
This is just an example .I have a model Person with fields
first_name, last_name
And after entering some records to the people table I tried the sql
Person.find(:all,:select => “first_name,#{first_name+last_name} as
full_name”)

  But this is not working Could anybody please tell how can I make

it work My ntention only just get result like
first_name full_name
abc abc d
AG AG h

Thanks

On Jun 24, 6:28 am, Sijo Kg [email protected] wrote:

Hi
This is just an example .I have a model Person with fields
first_name, last_name
And after entering some records to the people table I tried the sql
Person.find(:all,:select => “first_name,#{first_name+last_name} as
full_name”)

You don’t need the #{} in there.

Fred

But when I do that I get error
INT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
: SELECT first_name, first_name+last_name as full_name FROM “people”

On Jun 24, 8:14 am, Sijo Kg [email protected] wrote:

But when I do that I get error
INT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.

check your database documentation for the appropriate way to
concatenate two strings.

Fred

Hi
Thanks for the reply I did it like

arr = Person.find(:all,:select => “first_name,first_name||last_name as
full_name”)

May I ask one more question related to this ? Here in arr for each
element i get the methods like
first_name
first_name=
first_name?

 But I can't see any such like

full_name
full_name= etc But I can access it like arr.first.full_name
Why this?