SELECT * FROM `spv_store`, root_db, root_db AS root_db1 WHERE customer_uid = root_db.user_id AND distributor_uid = root_db1.user_id