mysql数据库中的多表查询问题

表1 log中的字段 log_id action enterprise_id operate_id record_time
表2 member中也有operate_id这个字段,还有name字段。
要求:要根据log表中的record_time字段的值 以20130801开始到20130805结束 这个区间段。取出log表中除了enterprise_id ,log_id这两个字段的,并且要把operate_id字段的值替换成member表中的字段值的其余全部字段的记录。
也就是 只有这三个字段的记录 action name record_time

没有看懂
并且要把operate_id字段的值替换成member表中的字段值的其余全部字段的记录。
是什么意思
如果是

只有这三个字段的记录 action name record_time 条件是record_time字段的值 以20130801开始到20130805结束 这个区间段

应该好写吧?

select a.action,b.name,a.record_time from tab1 a,tab2 b where a.operate_id=b.operate_id and a.record_time between '20130801' and '20130805';

好奇怪,我觉得不应该会问这么简单的问题,应该是lz的需求还没有描述清楚.
不过根据你现在的描述作出了回答,不知道能否解决你的问题.

select t1.action, t1.enterprise_id, t1.record_time, t2.*
from log t1, member t2
where t1.operate_id = t2.operate_id
and t1.record_time between '20130801' and '20130805'

多表查询需要用到表连接语句,方法有多种,内连接inner,外连接outer,等值链接等。链接完后就可以去任意的两表中的字段了。只需select你想要的字段就行。范围的话用between就可以了。

与楼上有同感,看起来确实没什么难度!!搞得疑惑是不是哪里没有理解透!但想来想去就只需要那一个多表查询语句,连左联什么的都不需要啊
select a.action,b.name,a.record_time from tab1 a,tab2 b where a.operate_id=b.operate_id and a.record_time between '20130801' and '20130805';这条语句就能够满足你的需求了