Welcome Guest, Not a member yet? Register   Sign In
Matching data from 2 table with validation date
#9

(This post was last modified: 02-09-2019, 08:29 AM by DELE.)

(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



Theme © iAndrew 2016 - Forum software by © MyBB