I have 6 listboxes and three date textboxes which I'm using to apply conditional filtering on a database table. What I need is if I select only a single textbox or a listbox value, or multiple listbox values and multiple date values I should be able to retrieve data based on only selected filter conditions from front end. The date or listbox values that I don't select should be skipped.
I have the following query but its not working.How should i write the query?
SELECT (MPMST.partyname + '' + ',' + '' + MPMST.contactperson) AS NAME
,(MPMST.email + '' + ',' + '' + MPMST.phone) AS ContactDetail
,MPMST.address
,(MPMST.city + '' + ',' + '' + MPMST.area) AS city_area
,MPMST.Already_Computer
,MPMST.software
,visit_time
,visit_purpose
,interaction
FROM MPMST
INNER
JOIN MCall ON MPMST.Partycode = MCall.Partycode
WHERE MCall.calltype IN ('SUP001')
AND MPMST.area IN ('pavai')
AND MPMST.city IN ('mumbai')
AND MCall.Date >= CONVERT(DATETIME ,'01/01/2014' ,103)
AND MCall.Date <= CONVERT(DATETIME ,'31/01/2014' ,103) MCall.status = ''
AND MPMST.software = ''
AND MPMST.Software <> ''
AND MPMST.City IS NOT NULL
AND MPMST.Area IS NOT NULL
my previous query was like
WHERE MCall.calltype IN ('SUP001') OR MPMST.area IN ('pavai') OR MPMST.city IN ('mumbai') AND OR MCall.status = '' OR MPMST.software = '' AND MPMST.Software <> '' AND MPMST.City IS NOT NULL AND MPMST.Area IS NOT NULL
..this query gave me only the records satisfying the first condition i.e..'Sup001'