SQL语句不起作用 [英] SQL Statement not working

查看:131
本文介绍了SQL语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个渔业公司的数据库,我有一个员工表,我想根据员工的角色来增加他们的工资.我做了一个SQL语句,但是它不起作用,它只是带有空白字段.

这是我的声明:

选择Staff的新工资中的名字,姓氏(工资* 1.15),其中StaffRole =``Admin'';

I have a database for a fishing company, I have a staff table and I want to increase the wages for the employees depending on their role. I made an SQL Statement but it doesn''t work, it just comes up with blank fields.

Heres my statement:

SELECT FirstName, Surname, (Wages * 1.15) as newwages from Staff where StaffRole = ''Admin'';

推荐答案

您的声明.
确保有StaffRole作为Admin的行.另外,请检查Staffrole列值的大小写.
There appears to be something wrong with your where statement.
Make sure there are rows with StaffRole as Admin. Also, check the case of the the staffrole column values.


尝试使用此方法..

选择FirstName,SurName,如果staffrole ="a",则工资* 100
当staffrole =''b''时工资* 200
以新工资"结尾
来自TableName;


U可以获取所需的输出....
try with this..

select FirstName,SurName, case when staffrole=''a'' then wages*100
when staffrole=''b'' then wages*200
end as ''New Wages''
from TableName;


U can get the required output....


这篇关于SQL语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆