使用OR子句和php数组选择SqlSrv查询的奇怪行为

时间:2021-11-20 07:44:20

Hello every one being very noob in querying database im come up with strange array behavior after using

大家好,在查询数据库im时,每个人都很容易在使用后产生奇怪的数组行为

select DISTINCT TEST,DIARY_NO 
FROM Laboratory.dbo.DEMAND_DETAILS 
WHERE DIARY_NO='RMU-442' AND (TEST='Bitumen Test' OR  TEST='Softening Point' OR TEST='Flash Point/Fire Point' OR TEST='Penetration of Bituminous Material')

in my php script

在我的php脚本

The array which is correspondence to that query is coming up like this

与那个查询对应的数组是这样的。

[{"id":"RMU-442","test":"Flash Point\/Fire Point","key":"tests"}]
[{"id":"RMU-442","test":"Flash Point\/Fire Point","key":"tests"},{"id":"RMU-442","test":"Softening Point","key":"tests"}]

Where as what i desired is

我想要的是什么

[{"id":"RMU-442","test":"Flash Point\/Fire Point","key":"tests"},{"id":"RMU-442","test":"Softening Point","key":"tests"}]

Any help regarding this would be great Thank you So much in advance

关于这方面的任何帮助都将是非常好的,提前非常感谢您

1 个解决方案

#1


0  

Try with IN

试着在

WHERE DIARY_NO='RMU-442' AND TEST IN ('Bitumen Test','Softening Point','Flash Point/Fire Point','Penetration of Bituminous Material')

#1


0  

Try with IN

试着在

WHERE DIARY_NO='RMU-442' AND TEST IN ('Bitumen Test','Softening Point','Flash Point/Fire Point','Penetration of Bituminous Material')