• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matching data from 2 table with validation date

#9
(02-08-2019, 09:19 AM)php_rocs Wrote: @DELE,

Are you familiar with views?  Not CI views but database views?


thank you very much for your help, my knowledge in the database is still ordinary. but now I have got what I want.

I look for differences between two tables.

thank you again for your help.


PHP Code:
public function test()
{
 
   $t $this->db->query("
        SELECT *
        FROM ( 
            SELECT users.id
            FROM users
            INNER JOIN campaigns
            ON users.id = campaigns.id
        ) users_campaigns
        WHERE NOT EXISTS ( 
            SELECT *
            FROM incomes
            WHERE users_campaigns.id = incomes.income_campaign
            AND incomes.income_date = '2019-02-02'
        )
    "
);

 
   print_r($t->result());
}

// RESULTS
// ID
// 005
// 008 
Reply


Messages In This Thread
RE: Matching data from 2 table with validation date - by DELE - 02-09-2019, 08:25 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.