Instaded to use a variuos AND statement in a where condition on field TEST i can use the statement
... where TEST in (ttt,iii,iuy)...eccc
Tks.
instead to use and ... and a....and in sql
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78592
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: instead to use and ... and a....and in sql
where TEST in ('ttt','iii','iuy')
is the same as
WHERE TEST='ttt' OR TEST='iii' OR TEST='iuy'
For an AND condition, you have to use
WHERE ThisField='ttt' AND ThatField='iii' AND OtherField='iuy'
is the same as
WHERE TEST='ttt' OR TEST='iii' OR TEST='iuy'
For an AND condition, you have to use
WHERE ThisField='ttt' AND ThatField='iii' AND OtherField='iuy'
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: instead to use and ... and a....and in sql
OK... tks for note.HansV wrote:where TEST in ('ttt','iii','iuy')
is the same as
WHERE TEST='ttt' OR TEST='iii' OR TEST='iuy'
For an AND condition, you have to use
WHERE ThisField='ttt' AND ThatField='iii' AND OtherField='iuy'
on fly... i need to update the filed MESE from DATA_CREAZ only with a month in format MM...
example:
DATA_CREAZ=12/12/2010 MESE=12
note:
DATA_CREAZ is formatted as Date MESE is Text
see the image vattached
You do not have the required permissions to view the files attached to this post.
Last edited by sal21 on 26 Oct 2010, 13:58, edited 1 time in total.
-
- Administrator
- Posts: 78592
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: instead to use and ... and a....and in sql
You can update to
Format([DATA_CREAZ], "mm")
Note the quotes around the format strong "mm".
Format([DATA_CREAZ], "mm")
Note the quotes around the format strong "mm".
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: instead to use and ... and a....and in sql
... base the IN condition how to insert in Field1 the two condition:HansV wrote:where TEST in ('ttt','iii','iuy')
is the same as
WHERE TEST='ttt' OR TEST='iii' OR TEST='iuy'
For an AND condition, you have to use
WHERE ThisField='ttt' AND ThatField='iii' AND OtherField='iuy'
Field1=" " or IsNull
-
- Administrator
- Posts: 78592
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: instead to use and ... and a....and in sql
You'd use
WHERE Field1=" " Or Field1 Is Null
(are you sure that you mean a space?)
WHERE Field1=" " Or Field1 Is Null
(are you sure that you mean a space?)
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: instead to use and ... and a....and in sql
YES!HansV wrote:You'd use
WHERE Field1=" " Or Field1 Is Null
(are you sure that you mean a space?)
During the rs(I) looping i se a var (refered the current record Var=" ")...
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: instead to use and ... and a....and in sql
HansV wrote:You'd use
WHERE Field1=" " Or Field1 Is Null
(are you sure that you mean a space?)
Based thi condition how to integrate the condition of field1 in existing SQL string?
SQL = "SELECT * FROM [CC_DAILY] WHERE [TIPO_DATO]='" & TEST_TIPO & "' AND COD_FIDO <> " & TEST_TIPO_CTR_2 & " AND CTR IN (" & TEST_TIPO_CTR & "," & TEST_TIPO_CTR_1 & ") AND INATT=" & INATTIVO & " ORDER BY COD_SPORT_RAD, COD_CONTO"
-
- Administrator
- Posts: 78592
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: instead to use and ... and a....and in sql
SQL = "SELECT * FROM [CC_DAILY] WHERE [TIPO_DATO]='" & TEST_TIPO & "' AND COD_FIDO <> " & TEST_TIPO_CTR_2 & " AND CTR IN (" & TEST_TIPO_CTR & "," & TEST_TIPO_CTR_1 & ") AND INATT=" & INATTIVO & " AND (Field1=" " Or Field1 Is Null) ORDER BY COD_SPORT_RAD, COD_CONTO"
Best wishes,
Hans
Hans