Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function in SQL 1

Status
Not open for further replies.

GeorgeDurkee

Programmer
Feb 22, 2000
47
US
What I want to do is select values from a table based on up to six sets of criteria. For each criteria, I want to display an X in a VB datagrid for the records that match the given criteria, so the result looks like this:
Identifier criteria1 critereia2 criteria 3
ABC X X
DEF X X
GHI X X

I can't figure out how to get the SQL statment to execute a function to determine if the value meets the criteria. What I am looking for is something like
Select *,function1(argument1),function1(argument) from table where criteria1, criteria2

I am running VB6 against an Access 2000 database until we can migrate over to Oracle or SQL Server.

Thanks

 
Code:
select Identifier
     , iif([i]condition1[/i],'X',' ') as criteria1
     , iif([i]condition2[/i],'X',' ') as criteria2
     , iif([i]condition3[/i],'X',' ') as criteria3
  from yourtable
 where [i]condition1[/i]
    or [i]condition2[/i]
    or [i]condition3[/i]

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (course starts January 9 2005)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top