For Programmers: Free Programming Magazines  


Home > Archive > ASP > March 2005 > SQL Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL Question
Jim Holmes

2005-03-23, 3:55 pm

I have an Access table with a column of ascending values. I am trying to
find the value in that column that is less than a calculated variable (kind
of like the vlookup function in Excel). Haven't had any success in writing
an sql statement or finding an example. Could someone point me in the right
direction? Thanks Jim


Curt_C [MVP]

2005-03-23, 3:55 pm

sql = "select * from tableName where field < " & yourValue


--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"Jim Holmes" <jch@fmlic.com> wrote in message
news:O3CjE07LFHA.3452@TK2MSFTNGP10.phx.gbl...
>I have an Access table with a column of ascending values. I am trying to
> find the value in that column that is less than a calculated variable
> (kind
> of like the vlookup function in Excel). Haven't had any success in
> writing
> an sql statement or finding an example. Could someone point me in the
> right
> direction? Thanks Jim
>
>



Jim Holmes

2005-03-23, 3:55 pm

Unfortunately, the code below only selects the first item in my table
instead of the 63rd (which is the first value less than 57.13).
value=57.13
mySql="SELECT * FROM monthly WHERE a_n < '"&value&"'"
Jim

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:OqKZt27LFHA.1476@TK2MSFTNGP09.phx.gbl...
> sql = "select * from tableName where field < " & yourValue
>
>
> --
> Curt Christianson
> Site & Scripts: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
>
> "Jim Holmes" <jch@fmlic.com> wrote in message
> news:O3CjE07LFHA.3452@TK2MSFTNGP10.phx.gbl...
>
>



PiGei

2005-03-23, 3:55 pm

I think yo have to eliminate the '

PGei

"Jim Holmes" <jch@fmlic.com> wrote in message
news:eJQepa8LFHA.3348@TK2MSFTNGP10.phx.gbl...
> Unfortunately, the code below only selects the first item in my table
> instead of the 63rd (which is the first value less than 57.13).
> value=57.13
> mySql="SELECT * FROM monthly WHERE a_n < '"&value&"'"
> Jim
>
> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> news:OqKZt27LFHA.1476@TK2MSFTNGP09.phx.gbl...
>
>



Curt_C [MVP]

2005-03-23, 3:55 pm

Are you sure? I mean are you looping through the results to show more then
1?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"Jim Holmes" <jch@fmlic.com> wrote in message
news:eJQepa8LFHA.3348@TK2MSFTNGP10.phx.gbl...
> Unfortunately, the code below only selects the first item in my table
> instead of the 63rd (which is the first value less than 57.13).
> value=57.13
> mySql="SELECT * FROM monthly WHERE a_n < '"&value&"'"
> Jim
>
> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> news:OqKZt27LFHA.1476@TK2MSFTNGP09.phx.gbl...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com