SELECT * from tbl_notification n where n.id_personal=2 AND n.`status`=0 OR n.`status`=1
em truy vấn lấy thông báo theo idPersonal… em xét lấy cả những status 1 với 0 mà khi run thì nó ra cả những idPersonal khác
SELECT * from tbl_notification n where n.id_personal=2 AND n.`status`=0 OR n.`status`=1
em truy vấn lấy thông báo theo idPersonal… em xét lấy cả những status 1 với 0 mà khi run thì nó ra cả những idPersonal khác
SELECT * from tbl_notification n where n.id_personal=2 AND n.`status` IN (0,1);
Hoặc
SELECT * from tbl_notification n where n.id_personal=2 AND (n.`status`=0 OR n.`status`=1);
bạn chú ý, phép AND có thứ tự ưu tiên cao hơn phép OR nên nó sẽ thực hiện phép AND trước, rồi lấy kết quả đó thực hiện phép OR.
Vâng… cảm ơn mọi người
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?