www.webdeveloper.com
Results 1 to 4 of 4

Thread: Access Query -> SQL Query

  1. #1
    Join Date
    Feb 2006
    Posts
    520

    Access Query -> SQL Query

    I have access query that I need convert to SQL. One of the fields has conditions that I do not know how to do on SQL side, please help!:
    PHP Code:
    LotStatusIIf([pub_jobPhase].[warraid]="reg05" And [pub_jobphase].[Model]<>"_LotSale","Builder Available",IIf(Not IsNull([pub_jobsales].[finalsaledate] Or ([pub_jobphase].[Model]="_LotSale")),"Closed",IIf([description]=" ","Available",IIf(([sales status]="spec" Or [sales status]="model" Or [sales status]="ssbto" Or [sales status]="ssip" Or (Not IsNull([description]) And IsNull([pub_jobsales].[finalsaledate]))),"Allocated")))) 
    Last edited by TiGGi; 03-27-2006 at 10:50 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    NCAA Tournament Hell
    Posts
    21
    SQL Server does not support IIF

    Replace that with CASE statements

  3. #3
    Join Date
    Feb 2006
    Posts
    520
    I understand CASE, but how do I do multiple condition within one CASE:

    if filed1 = '5' AND filed2 <> '' and field3 = '01/01/01' then 'whatever'
    or
    if filed1 = '5' or filed1 = '7' then 'whatever'

  4. #4
    Join Date
    Apr 2006
    Posts
    7

    Post

    try this one

    case <your_fld>
    when <fld_value> then <expectedoutput>
    when <fld_value> then <expectedoutput>
    else <output if conditions not met>
    end as <your fld name>

    hope it helps!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles