php - Error getting last 3 rows from mysql query -
i trying last 3 rows query keep getting error:
sqlstate[42s21]: column exists: 1060 duplicate column name 'id'
please, doing wrong here?
$sql = "select * (select i.*, m.*, p.* message join members m on m.id = i.sender_id join profile_photos p on p.member_id = m.id (receiver_id = :receive , sender_id = :sent or receiver_id = :sent , sender_id = :receive) order date desc limit 3) t order date asc";
you have id
column in more 1 table , select statement select i.*, m.*, p.*
listing them all.
either choose specific column want like
select i.id, i.col1, m.col2, p.col3 ...
or, use column alias like
select i.id iid, m.*, p.id pid
Comments
Post a Comment