处理多个表并在获取表记录期间出现问题

时间:2019-06-22 06:57:02

标签: php mysql

处理多个表并在获取表记录时出现问题

引荐历史记录表:

enter image description here

钱包表:

enter image description here

我当前的MySql查询:

$qry="SELECT * FROM `ci_referal_history` as rh,`ci_scratch_cards` as sc WHERE rh.`referal_id`=sc.`clt_id` AND rh.`referal_id`='".$this->session->userdata('inv_clt_id')."' AND sc.`clt_id`='".$this->session->userdata('inv_clt_id')."' ORDER BY rh.`added_date`,sc.`sent_date` DESC";

获得如下所示的O / P:

enter image description here

但是现在我想显示如下记录:

SR.NO. | Credited Through | Credit

  1    |     Referral     | 51

  2    |    Scratch Card  | 3  

所以请您提出查询建议

我要按日期降序排列

是否可以通过mysql-join ..

0 个答案:

没有答案