Basic SQL question

I have a Select field {tempted}
I select an item in the drop down to Table A, which displays the Key to the record, and a corresponding value from the table A
I created an Ajax event onChange of {tempted} , which does a query on Table A and uses the Key to do a lookup
The lookup SQL fails, because the key {tempted} is blank!
Can’t see why
Been at it for 9 hours and don’t think I am thinking straight any more

Would be appreciative of help


Screenshot 2025-06-03 at 11.06.41 PM

Hi
in the lookup method add ‘’
where rangeid=’{rangeid}’