[thelist] ASP & SQL

Jay Blanchard jay.blanchard at niicommunications.com
Thu Sep 12 14:07:01 CDT 2002


--
[snip]
i say build your query based on the information you DO have. for
example...

if you have all three variables, do something like this...

SELECT fname, lname, location
 FROM employees
 WHERE fname = <varFName> AND
       lname = <varLName> AND
       location = <varLocation>

alternatively, if you've only got First Name and Location to work
with...

SELECT fname, lname, location
 FROM employees
 WHERE fname = <varFName> AND
       location = <varLocation>

and one more example (First Name, Last Name)...

SELECT fname, lname, location
 FROM employees
 WHERE fname = <varFName> AND
       lname = <varLName>


this requires a little more scripting and maybe some If statements, but
i don't know enough about SQL to write a complete query that would do
the same thing.
[/snip]

Don't forget just Last Name and Location. And actually you would want to
build queries on single items as well...

First Name Only
Last Name Only
Location Only
First Name & Last Name & Location
First Name & Last Name
First name & Location
Last Name & Location

So you have to be prepared to build 7 queries based on information supplied.
You can use a CASE statement to encase them all.

HTH!

Jay
--
[ winmail.dat was deleted, please don't send attachments with your message. ]
--





More information about the thelist mailing list