我在
下有数据库表名(temp_vendor)material nvarchar(255)
vendor nvarchar(255)
和表中的数据如下
-cbxsasp000034 , Supack
-cbxsasp000034 , FAIRPAC
-CBXSASP000043 , VISHAL
-HDBGPLN000062, MAHALAXMI
-cbxsasp000034 , VIM PAC
-cbxsasp000034 , Supack
-cbxsasp000034 , Supack
-CBXSASP000043 , Supack
-CBXSASP000043 , Supack
-6000004, RAMA ploycon
我的问题是,我只想选择物料和供应商均为1的记录。从表中意味着物料的供应商仅为1的记录。我该如何查询?请帮助我,在此先感谢
答案 0 :(得分:2)
您可以按物料分组并计算供应商数量:
SELECT material
FROM temp_vendor
GROUP BY material
HAVING COUNT(DISTINCT vendor) = 1
答案 1 :(得分:0)
如果您需要所有列选择,可以尝试使用存在
<?php
if (isset($_SERVER, $_SERVER['SERVER_NAME'])) {
if ($_SERVER['SERVER_NAME'] === 'localhost') {
// set base path to localhost/project_folder
} else {
// set base path to www.example.com <- MORE SECURE
// or, set base path to $_SERVER['SERVER_NAME'] <- INSECURE (any server could be written to the config)
}
}