I have this code:
unfortunately it sometimes brings back more than 1 row for example:
I only want the row with the highest templateid brought back, which is what I thought max(a.templateid) would do?
Code:
Select max(a.templateid) as templateid, a.questionid, a.ANSWER, a.quoteid
from PPT_Answer A, PPT_Question Q
where A.QUESTIONID = Q.questionID
and A.templateid = Q.templateid
AND A.QuoteID='TCA0136327'
and a.answercell = 'B15'
group by a.questionid, a.answer, a.quoteid
Code:
TEMPLATEID QUESTIONID ANSWER QUOTEID
532 EndPointsSingleLinePhonesIP 10 TCA0136327
545 EndPointsSingleLinePhonesIP 9 TCA0136327
I only want the row with the highest templateid brought back, which is what I thought max(a.templateid) would do?