检索与4个表中任意2个表中的字段匹配的记录

时间:2015-06-02 04:22:37

标签: mysql cakephp

我有四个具有相同字段的表。现在我想以这样一种方式连接这些表,即只有当字段上的任何两个表之间存在匹配时才检索记录(如名称)。 提前谢谢。

1 个答案:

答案 0 :(得分:2)

这将返回出现在多个表中的所有after_filter :store_location def store_location return unless request.get? if (request.path != "/users/sign_in" && request.path != "/users/sign_up" && request.path != "/users/password/new" && request.path != "/login" && request.path != "/signup" && request.path != "/users/password/edit" && request.path != "/users/confirmation" && request.path != "/users/sign_out" && !request.xhr?) # don't store ajax calls session[:previous_url] = request.fullpath end end def after_sign_in_path_for(resource) if request.referer == streams_url(page: params[:page]) session[:previous_url] || root_path else root_path end end 值:

name

查看interactive example