mysql查找表名

一个查询,查询的是两个表的相同字段,而且要区分这个字段是哪个表中查找出来的,所以要把表名也找出来。怎么做呢?

这表是系统表 加索引估计不好弄了

看这里
[url]http://www.cnblogs.com/cocowool/archive/2009/12/04/1617136.html[/url]

用select
http://guides.rubyonrails.org/active_record_querying.html#selecting-specific-fields

[quote]
ree-1.8.7-2011.03 :003 > Post
=> Post(id: integer, title: string, body: text, created_at: datetime, updated_at: datetime)
p = Post.select('id as hi').first
Post Load (0.1ms) SELECT id as hi FROM "posts" LIMIT 1
ree-1.8.7-2011.03 :011 > p.hi
=> 1
[/quote]

你看,SQL语句,然后post的默认字段,本来是没有hi这个字段的,rails会根据你的select而自动生成属性方法