在SQL中选择查询 [英] Select Query in SQL

查看:133
本文介绍了在SQL中选择查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中的字段如下
已付款位
profilelimit数字
个人资料访问过的数字
schemeexpiry datetime

我想编写一个简单的SELECT查询,该查询根据profilevisited或schemeexpiry为我提供ISPAID的值.

如果Profilevisited大于profilelimit或schemeexpiry日期大于今天的日期,则ispay应该返回false,否则应为true.

任何帮助plz .....

I have a table having fields as follow
ispaid bit
profilelimit numeric
profilevisited numeric
schemeexpiry datetime

I want to write a simple SELECT query which give me the value of ISPAID according to profilevisited or schemeexpiry.

If Profilevisited is greater than profilelimit or schemeexpiry date is greater than today''s date then ispaid should return false otherwise it should come true.

Any help plz.....

推荐答案

hihirn
我认为这对您有帮助:

选择案例已付款
何时(
从[表名]中选择*,其中Profilevisited> profilelimit和schemeexpiry> getdate()
),然后显示"false"
当(从[表名]中选择*,其中Profilevisited< = profilelimit和schemeexpiry< = getdate())时为"true"
底壳

来自[tablename]


如果这对您有帮助,请在vipsha16.com上回复我
hi hiren
I think this will help u :

select case ispaid
when (
select * from [tablename] where Profilevisited >profilelimit and schemeexpiry > getdate()
) then "false"
when (select * from [tablename] where Profilevisited <= profilelimit and schemeexpiry <= getdate()) then "true"
end case

from [tablename]


please reply me on vipsha16.com if this will help u


这篇关于在SQL中选择查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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