I have the following query I am trying to correct:
BoolSearch contains the following:
((MessageID Like '%97DD1C42-F841-11D4-A0AD00508BFDDBDD%')) OR ((MessageID Like '%43C5B61E-F849-11D4-A0AF00508BFDDBDD%'))
What I am trying to do is retrieve the author's name from the PersonTable based on the ID stored in the MsgAuthor column of MessageTable. What happens is, it retrieves all the people. I want two records returned, it returns 23. I use the following similar query in another place, and it works fine.
Any suggestions? Thanks!
Code:
<!--- Perform Queries --->
<CFQUERY NAME="GetMessages"
DATASOURCE="#Application.Datasource#"
DBTYPE="ODBC">
SELECT MessageID,
MsgSubject,
MsgThreadID,
MsgDatePosted,
MsgMessage,
MsgForumID,
PersonFirstName,
PersonLastName,
PersonEmail
FROM MessageTable,
PersonTable
WHERE #PreserveSingleQuotes(boolsearch)#
AND MsgAuthor = PersonID
ORDER BY MsgDatePosted <CFIF Client.PostOrder IS "Newest">DESC</CFIF>
</CFQUERY>
BoolSearch contains the following:
((MessageID Like '%97DD1C42-F841-11D4-A0AD00508BFDDBDD%')) OR ((MessageID Like '%43C5B61E-F849-11D4-A0AF00508BFDDBDD%'))
What I am trying to do is retrieve the author's name from the PersonTable based on the ID stored in the MsgAuthor column of MessageTable. What happens is, it retrieves all the people. I want two records returned, it returns 23. I use the following similar query in another place, and it works fine.
Code:
SELECT MessageID,
MsgSubject,
MsgThreadID,
MsgDatePosted,
MsgMessage,
MsgForumID,
PersonFirstName,
PersonLastName,
PersonEmail
FROM MessageTable,
PersonTable
WHERE MsgThreadID = '#URL.ThreadID#'
AND MsgAuthor = PersonID
ORDER BY MsgDatePosted <CFIF Client.PostOrder IS "Newest">DESC</CFIF>
Any suggestions? Thanks!