Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,
I want to create an sql statement which will compare an external number if it is smaller to 1 than a field of an access database eg. select * where num (greater to 1) than a(integer), this was pseudo code, if there is such code please help.

Thank you
Kyriakos
Posted
Comments
nrgjack 29-Feb-12 3:07am    
what do you expect by the compare ?

the list of items with a field grater than 1
or a list of items true or false depending on they are greater than 1 or not?

true or false if equal to 1 (eg select * from table where num -(minus) a(var) = 1
 
Share this answer
 
SQL
SELECT *
FROM mytable
WHERE @num<1 AND mytable.a>@num

@num is the parameter for your external number.
Since I failed to fully understand both conditions, you may need to adjust above statement, but the main point is to have an "AND" in the WHERE clause.
 
Share this answer
 
select
case when
num > external_num
then 'true'
else 'false'
end
from table


this will work or adjust is according to your need
 
Share this answer
 
v3
Hello,
I have found the solution with a parameter, maybe my question wasn't so clear. Here is the solution.
SQL
SELECT * FROM [table] WHERE month1 - @monthpar = '1'

And through a textbox which holds date.now.month (parameter.value) I get the result.

Thank you
Kyriakos
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900