带数组的sql

时间:2013-03-21 03:19:02

标签: sql

这个循环可以在sql中完成吗?

Dim ID(0 TO 2) as string
Dim number as string

ID="01"
ID="02"


For each number in ID
   SELECT data FROM sheet1 WHERE data= number
next number

datatable:
data
01
01
02
03
04

1 个答案:

答案 0 :(得分:1)

这可以使用IN谓词:

来完成
SELECT data FROM sheet1 WHERE data IN(1, 2);