I have the following sqldatasource query statement that returns wrong results. The output depends on rows in the Business-Rating table.So if there are two rows, it returns all rows that match. while i want it to return all rows that match the MarketPlace_SAddress table instead. So for each row in [Inbox_Messages] that match MarketPlace_SAddress table i want it to return all the data present plus the data in [Business-Rating] table.
So i should in theory retrieve 3 rows that include address details. Yet i only get address details on 2 rows.
The sql was generated from sqldatasource wizard!
SelectCommand="SELECT * FROM Inbox_Messages LEFT OUTER JOIN MarketPlace_SAddress left outer JOIN [Business-Rating] ON MarketPlace_SAddress.UserName = [Business-Rating].Business_UserName ON Inbox_Messages.InboxId = [Business-Rating].MessageId WHERE (Inbox_Messages.RecieverID = @Recieverid or senderid=@recieverid or username=@recieverid) AND (Inbox_Messages.MessageType = 'Services' ) OR (Inbox_Messages.MessageType = 'Services' ) AND (Inbox_Messages.SenderID = @Recieverid) "