SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Ms Access

  1. #1
    SitePoint Enthusiast t2india's Avatar
    Join Date
    Aug 2003
    Location
    India
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ms Access

    I need a query which will work in MS Access case is if rate is 0 then keep it as 0 otherwise add 50 to the rate.

    MySql equivalent to this query is
    ///////////////
    select hotel_name, if(rate=0,0,rate+50) as rate from hotel_rates order by rate

    or

    select hotel_name,
    case rackRentDouble
    when 0 then 0
    else (rackrentDouble+50)
    end
    from hotel_rates
    order by rackRentDouble
    ////////////////////////

    But both the queries are not working in Access. Please help me.
    Travelling to India visit t2india.com
    All India travel

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Code:
    select hotel_name
         , iif(rate=0,0,rate+50) as newrate 
      from hotel_rates 
    order 
        by iif(rate=0,0,rate+50)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast t2india's Avatar
    Join Date
    Aug 2003
    Location
    India
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, You helped again
    Travelling to India visit t2india.com
    All India travel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •