sql error: SELECT DISTINCT UserRelations.UserID, UserRelations.RelatedID, users.id AS UUserID, users.last_name AS ULastName, users.first_name AS UFirstName, users.link AS UUserPage, users.avatar AS UAvatar, URFavorite.RelationID AS UTFavorite, URFollow.RelationID AS UTFollow, UROwn.RelationID AS UTOwn, URBorrow.RelationID AS UTBorrow, URBorrowed.RelationID AS UTBorrowed, URRed.RelationID AS UTRed, URReading.RelationID AS UTReading, URWish.RelationID AS UTWish, URGive.RelationID AS UTGive, URBarter.RelationID AS UTBarter, URBorrowTo.RelationID AS UTBorrowTo, BibTitles.CoverImage FROM UserRelations LEFT JOIN BibTitles ON BibTitles.TitlesID=244009-d LEFT JOIN users ON users.id=UserRelations.UserID LEFT JOIN UserRelations AS URFavorite ON URFavorite.UserID=UserRelations.UserID AND URFavorite.RelatedTypeID="1" AND URFavorite.RelatedID="244009-d" AND URFavorite.RelationID="1" LEFT JOIN UserRelations AS URFollow ON URFollow.UserID=UserRelations.UserID AND URFollow.RelatedTypeID="1" AND URFollow.RelatedID="244009-d" AND URFollow.RelationID="2" LEFT JOIN UserRelations AS UROwn ON UROwn.UserID=UserRelations.UserID AND UROwn.RelatedTypeID="1" AND UROwn.RelatedID="244009-d" AND UROwn.RelationID="3" LEFT JOIN UserRelations AS URBorrow ON URBorrow.UserID=UserRelations.UserID AND URBorrow.RelatedTypeID="1" AND URBorrow.RelatedID="244009-d" AND URBorrow.RelationID="4" LEFT JOIN UserRelations AS URBorrowTo ON URBorrowTo.UserID=UserRelations.UserID AND URBorrowTo.RelatedTypeID="1" AND URBorrowTo.RelatedID="244009-d" AND URBorrowTo.RelationID="19" LEFT JOIN UserRelations AS URBorrowed ON URBorrowed.UserID=UserRelations.UserID AND URBorrowed.RelatedTypeID="1" AND URBorrowed.RelatedID="244009-d" AND URBorrowed.RelationID="5" LEFT JOIN UserRelations AS URRed ON URRed.UserID=UserRelations.UserID AND URRed.RelatedTypeID="1" AND URRed.RelatedID="244009-d" AND URRed.RelationID="6" LEFT JOIN UserRelations AS URReading ON URReading.UserID=UserRelations.UserID AND URReading.RelatedTypeID="1" AND URReading.RelatedID="244009-d" AND URReading.RelationID="7" LEFT JOIN UserRelations AS URWish ON URWish.UserID=UserRelations.UserID AND URWish.RelatedTypeID="1" AND URWish.RelatedID="244009-d" AND URWish.RelationID="8" LEFT JOIN UserRelations AS URGive ON URGive.UserID=UserRelations.UserID AND URGive.RelatedTypeID="1" AND URGive.RelatedID="244009-d" AND URGive.RelationID="9" LEFT JOIN UserRelations AS URBarter ON URBarter.UserID=UserRelations.UserID AND URBarter.RelatedTypeID="1" AND URBarter.RelatedID="244009-d" AND URBarter.RelationID="10" WHERE UserRelations.RelatedID="244009-d"