If statement in query (1 Viewer)

Joy83

Member
Local time
Yesterday, 17:23
Joined
Jan 9, 2020
Messages
116
Hi
I have a query that has a certain number
I want to creat a new column in the same query an expression:
If this number between 1 and 10 then put the value 1
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:23
Joined
Jan 23, 2006
Messages
15,379
Better to show us the query. Even go to sql view, copy the code and paste.
Also a sample of before and after would help with communications.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:23
Joined
Feb 19, 2002
Messages
43,223
Select fld1, fld2, fld3, IIf(fld3 Between 1 and 10, 1, Null) As CalcField From yourtable
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:23
Joined
Feb 28, 2001
Messages
27,138
Note that TECHNICALLY, you cannot create or not create a field, you can only populate or not populate the field you created.
 

Users who are viewing this thread

Top Bottom