Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Select max number

How can I look at table1.dbo.salesTotal and get the max number that is less than or = to  a money variable amount?

compare @var = $200

to this list

salesTTL
100
150
199
201

And return 199
0
lrbrister
Asked:
lrbrister
  • 2
1 Solution
 
Philip PinnellCommented:
select max(salesTTL) from salesTotal where salesTTL<=200
0
 
lrbristerAuthor Commented:
0
 
Imran Javed ZiaCommented:
Hi,

You can use following query where @var is variable

Select Max(salesTTL) as salesTTL From dbo.salesTotal Where salesTTL <=@var

Thanks
0
 
Philip PinnellCommented:
Thanks
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now