How to exclude result from 2 different table and show the result?

Posted by Lucy Amalia Lusiana on Stack Overflow See other posts from Stack Overflow or by Lucy Amalia Lusiana
Published on 2012-12-09T04:25:58Z Indexed on 2012/12/09 5:04 UTC
Read the original article Hit count: 154

Filed under:

I have 2 tables:

  • T1 (Total User)
  • T2 (User_id_that_have_done_something_for_today)

the mysql_query result from T1 are

(Total User)
-----
ID
-----
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |

the mysql_query from T2 are

(logged)
-----
user_id_log
-----
| 1 |
| 3 |
| 4 |
| 7 |

How to compare T1 and T2 And only show the user that not approved?

The end result that i wanted is

(result)
-----
ID
-----
| 2 |
| 5 |
| 6 |
| 8 |

I spent 2 days to make this work but i cannot do it

I have try LEFT JOIN and NOT IT but the result is not what i wanted

Please help me, thank you

© Stack Overflow or respective owner

Related posts about mysql