易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : sql

sql 按条件 删除表

现有:
表a用来记录表名
id name
1  b
2  c

存在表b,
现在要删除表b: drop b,但前提是在表a中存在name='b',语句该怎么写?一句完成哦
SQL code:
if exists(select 1 from a where name='b')
drop table b
go

SQL code:
Create Table a
(
[id] int not null,
[ ......

一条SQL 语句

我想查出 类型名字是‘单方精油’的所有 产品 我写了一条但是不对:
select pro_ID,pro_Name,prc_Name,pro_Content,pro_Nums,pro_Price,pro_MoneyType,pro_BigPicUrl,pro_Intro from
WT_Products,WT_ProCategory 
where WT_Products.prc_ID= WT_ProCategory.prc_ID and prc_Name='单方精油' and pr ......

问一个SQL查询的问题


如上图,这其实是一个巡更班次表,其中4:00:00对应的ClassGroupID是当天的第一班组的ID,小于这个时间的应该算是前一天的最后一个班组的了,现在要用语句取得ClassGroupID的顺序为 11,12,13,但是不能以order by classgroupid asc这么来,因为这个ID的大小不能作为排序依据
我用这个语句取得的就不对了,事实上ClassGroupID ......

求一SQL - MS-SQL Server / 基础类

tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间内的期初金额,本期入库金额,本期出库金额,本期结存。
kindname,beginmoney,insummoney,outsummoney,end ......

SQL函数求解

若输入'12:01|14:05|16:15|19:13'
循环输出|隔开的字符串,结果是:12:01  14:05  16:15  19:13
用while循环实现.(有可循环4次,必须得用while循环) 谢谢!

引用
SQL codedeclare@svarchar(1000)set@s='12:01|14:05|16:15|19:13'declare@ttable(tvarchar(10))set@s=@s+' ......

Sql 触发器逻辑

A表
A列 int
B列  int

如果在插入过程中A列的值大于9,则B列自动为1.此时A列清0;


SQL code:
create trigger tri_insert_tb
on tb
instead of insert
as
if exists(select 1 from inserted where a>9)
begin
insert tb(a,b)
select 0,1
from inserted
where a>9
end
......
总记录数:3315; 总页数:553; 每页6 条; 首页 上一页 [212] [213] [214] [215] 216 [217] [218] [219] [220] [221]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号