假设我有一个包含一些列的表,其中一列名为col
。如果可能的话,我想在语句中应用以下过滤器SELECT
。
col = ""
THEN 返回整个表col = the given value
例子:
col output
10 9
9 8
0 10
Run Code Online (Sandbox Code Playgroud)
如果我想根据列过滤结果,col
那么我可以做一个简单的操作:
SELECT * FROM table
WHERE col = 10
Run Code Online (Sandbox Code Playgroud)
我只会得到 col=10 的行。
但如果条件是,我想获得完整的表格col = "
。
编辑:不幸的是,我无法使用SET
关键字来设置变量。
在我的表格中,我使用下拉显示日,月,年.你能帮我验证一下日期吗?我必须验证输入的年龄是否大于15.还要检查闰年等.
我在数据库作业中遇到这个问题并需要回答这个问题:
哪位员工对购买次数最多的客户的销售额最高?
这些是我尝试编写这个查询
--select Customers.Firstname,Products.Name,Sales.Quantity from Customers
--inner join Sales
--on Customers.CustomerId=Sales.CustomerId
--inner join Products
--on Sales.productId=Products.ProductId
--where Products.Name like 'Mobile'
--Select Customers.CustomerId,max(COUNT(Customers.CustomerId)) As Customecount,Emploees.EmploeeId,max(COUNT(Emploees.EmploeeId))as EmploeeeCount from Emploees
--inner join Sales
--on Emploees.EmploeeId=Sales.EmploeeId
--inner join Customers
--on Customers.CustomerId=Sales.CustomerId
--group by Customers.CustomerId,Emploees.EmploeeId ,Count(Sales.productId)as productCount,Count(Emploees.EmploeeId)as emploeeCount,Count(Customers.CustomerId)as customerCount
select * from
(select Distinct Customers.CustomerId,Sales.productId,COUNT(Sales.productId)as CountProduct from Customers
inner join Sales
on Customers.CustomerId=Sales.CustomerId
inner join Emploees
on Emploees.EmploeeId=Sales.EmploeeId
group by Sales.productId,Emploees.EmploeeId,Customers.CustomerId,Sales.productId) as Result
--gr
Run Code Online (Sandbox Code Playgroud)
但这些都不起作用
请帮我写这个查询。
我有点尴尬地问这个,但我一直得到意外的错误"{"
<?php
$c = trim($_POST['cm']);
$inc = trim($_POST['inches']);
$resultat;
if (isset($c)) && (isset($inc)){
echo "string";
exit();
}
if(isset($c)){
echo "string";
exit();
}
if(isset($inc)){
echo "string";
exit();
}
?>
Run Code Online (Sandbox Code Playgroud)
我测试两个变量是否为空,然后我测试其中一个是否为空......但我在每个if语句下都会出现语法错误...无法看到我错过了什么?