我需要为以下问题构建查询字符串 -
我的每周访问表 -
batch_code bday duration period_no branch
B001 Sun 1 2 Jamnagar City
B001 Mon 1 2 Jamnagar City
B001 Tue 1 2 Jamnagar City
B002 Mon 1.3 4 TATA
B002 Mon 1.3 4 TATA
B003 Sun 1 1 Jamnagar City
B003 Mon 1 1 Jamnagar City
B004 Sun 2 2 Reliance
B004 Mon 2 2 Reliance
B004 Tue 2 2 Reliance
B005 Sun 2 2 TATA
B005 Mon 2 2 TATA
B005 Tue 2 2 TATA
B006 Sun 1.3 4 Jamnagar City
B007 Wed 1.3 4 Jamnagar City
答案 0 :(得分:1)
SELECT * FROM YourTableName WHERE bday ='Sun'AND(branch ='Jamnagar City'OR branch ='Reliance')
SELECT * FROM YourTableName WHERE bday ='Sun'AND(branch ='Jamnagar City'OR branch ='Reliance'OR branch ='TATA')
我相信你可以使用IN命令,但如果它在Access中有效,我不肯定。你可以尝试一下。语法是:
SELECT * FROM YourTableName WHERE bday ='Sun'AND branch IN('Jamnagar City','Reliance','TATA')