0

I have a table named tbllog, it's field is type, userid, action, datelog. The userid is a foreign key coming from tbluser. some userid in my tbllog is 0 and i can't seem to display it using these query.

SELECT * FROM tbllog INNER JOIN tbluser ON (tbluser.userid = tbllog.userid)

It does display a rows consist of non-zero userid. My question is how to display all the data from tbllog whether the userid is 0 or not?

Al bassam
  • 225
  • 1
  • 4
  • 16

1 Answers1

1

Try This

SELECT * FROM tbllog 
LEFT JOIN tbluser 
ON tbluser.userid = tbllog.userid

For More Info http://dev.mysql.com/doc/refman/5.7/en/join.html

Vipin Jain
  • 3,686
  • 16
  • 35