Source problem for grid

  • Thread starter Thread starter Poppy
  • Start date Start date
P

Poppy

I have a table which contains job vacancies.

The 2 fields concerned are "JOBTYPE" and "WAGE".
JOBTYPE can be either "Permanent" or "Part time".
WAGE can be either per annum e.g "15000" or per hour e.g "7.50".

On the search page if the user chooses to search for both Permanent and Part
time vacancies a drop down appears showing minimum wage in per annum format
e.g "10000", "15000" e.t.c.

I need to be able to query the table for all vacancies where WAGE >
drpWage.selecteditem.text but I also need to search for WAGE * 2000 >
drpWage.selecteditem.text in the case of Part time vacancies.

How can I join the 2 above so that I can use these as a source for a
datagrid and what is the correct sql syntax for "WAGE * 2000". I have never
performed math operations in SQL.

TIA
 
You can do this in a couple of ways.

- Run it in a single query and perform a UNION where you get both sets of
results. See SQL Server BOL for more information on how to do UNION queries.
- Run the queries separately, and combine the 2 datasets.

As far as the query goes:
SELECT blah FROM foo WHERE (WAGE * 2000) > @wagevalue
 
Back
Top