Dear members.
Colud you please tell me how to alias column name with join?
departments and employees table has same column: ``name''.
I would like to join both tables.
And I would like to rename both columns as dept_name and full_name.
I can execute join, but I don't know how to alias both table.
depts.join_table(:inner, employees, { :dept_id => :id }).all
Sincerely.
--
Hiroyuki Sato.
departments table
sqlite> select * from departments;
id|name
1|marketing
2|sales
employees table.
sqlite> select * from employees;
id|name|dept_id
1|alice|2
2|bob |2
3|carol|1
In SQL, I woud like to execute the following.
select depts.name as dept_name,
emp.name as full_name
from departments depts,
employees emp
where depts.id = emp.dept_id
Expect result.
dept_name |full_name
sales |alice
sales |bob
marketing |carol
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.