# MSSQL Search Statement



## msfdisk (Jan 5, 2007)

I'm new to MSSQL. I need to develop 2 Search Functions based on several dropdowns, fields, etc. Most "criteria" are in different tables.

What is the best way to effeciently do this?

Thanks


----------



## Rockn (Jul 29, 2001)

What are you using as the interface for the search? I think it is more Dependant on the application you are using than MSSQL.


----------



## msfdisk (Jan 5, 2007)

My pages are developed in PHP...
Several tables are not related.



Rockn said:


> What are you using as the interface for the search? I think it is more Dependant on the application you are using than MSSQL.


----------



## MMJ (Oct 15, 2006)

Use the select statement.


----------



## Rockn (Jul 29, 2001)

MMJ said:


> Use the select statement.


Gee really! The problem is running it against several tables that have no relationship. You could set up a submit button for each text field or use something like SWITCH based on which text field is not empty on your form.


----------



## MMJ (Oct 15, 2006)

I don't see whats so hard about it, I've done it before.


----------



## Rockn (Jul 29, 2001)

Well maybe our friend could post some code and you could hook him up?


----------



## msfdisk (Jan 5, 2007)

I did a select...
where criteria
UNION ALL
select...
where criteria
UNION ALL

that got me alot of NULL values
since the tables are not in relation, is there a way to somehow group these unrelated tables?


----------

