liltbrockie

Help with ExecuteSQL query please

Discussion created by liltbrockie on Dec 21, 2012
Latest reply on Dec 28, 2012 by liltbrockie

Hi can someone help with this SQL query please? I am trying to retrieve a list of matching addresses based on what the user enters:

 

ExecuteSQL ( "

 

SELECT UPPER(addressid)

 

FROM AddressSurname

 

WHERE

 

UPPER(surname) LIKE ? and

UPPER(firstname) LIKE ? and

UPPER(postcode) LIKE ?

"

 

; "" ; "";

Upper(Enquiries::Surname&"%");

Upper(Enquiries::Firstname&"%");

Upper(Enquiries::Postcode&"%") )

 

The above code kind of works but it does not account for fields that are NULL

The problem being if I enter in "Smith" for the surname I ONLY get results if there is date in the firstname field (which there often isnt)

I have attached a demo file

Attachments

Outcomes