数据库查询语句(DBA)
select c.path from tsp_goodscategory c where = '联想笔记本';
select as 分类名称,
t.goodsquantity as 商品总数量,
t.sellgoodsquantity as 可卖商品数量
from tsp_goodscategory t
where
instr('4028807c33b057770133b0a2967d0017,4028807c33b057770133b0a342a30019,4028807c33 b057770133b0a7d851001f', t.id, 1, 1) > 0;
INSTR(C1,C2,I,J) 在一个字符串中搜索指定的字符,返回发现指定的字符的位置;
C1 被搜索的字符串
C2 希望搜索的字符串
I 搜索的开始位置,默认为1
J 出现的位置,默认为1
SQL> select instr("abcde",'b');
结果是2,即在字符串“abcde”里面,字符串“b”出现在第2个位置。如果没有找到,则返回0;不可能返回负数
1、substr(string string, int a, int b)
参数1:string 要处理的字符串
参数2:a 截取字符串的开始位置(起始位置是0)
参数3:b 截取的字符串的长度(而不是字符串的结束位置)
例如:
substr("ABCDEFG", 0); //返回:ABCDEFG,截取所有字符
substr("ABCDEFG", 2); //返回:CDEFG,截取从C开始之后所有字符
substr("ABCDEFG", 0, 3); //返回:ABC,截取从A开始3个字符
substr("ABCDEFG", 0, 100); //返回:ABCDEFG,100虽然超出预处理的字符串最长度,但不会影响返回结果,系统按预处理字符串最大数量返回。
substr("ABCDEFG", 0, -3); //返回:EFG,注意参数-3,为负值时表示从尾部开始算起,字符串排列位置不变。
2、substr(string string, int a)
参数1:string 要处理的字符串
参数2:a 可以理解为从索引a(注意:起始索引是0)处开始截取字符串,也可以理解为从第(a+1)个字符开始截取字符串。
例如:
substr("ABCDEFG", 0); //返回:ABCDEFG, 截取所有字符
substr("ABCDEFG", 2); //返回:CDEFG,截取从C开始之后所有字符
select *
from tsp_goods g
where g.store_id =
(select id from tet_store t where t.storename = '709394')
and isdelete = '0'
and ismarketable = '1';
select * from tsp_product p join tsp_goods g on p.goods_id = g.id
where g.store_id=(select id from tet_store t where t.storename='709394') and p.isdelete='0' and p.i smarketable='1';
select*from tsso_member m where m.modifydate =to_date('2011-3-8 14:05:33','yyyy-mm-dd hh24:mi:ss');(日期格式查询)
select*from test09csc.tsso_member
where lower(substr(email,instr(email,'@','-1')+1,1000))
NOT in('','','','','')
or email is null
order by email;
substr(email, instr(email, '@', '-1')+1, 1000)
就是取@符号后的字符串。
如:123456@ 返回
-1 是instr从后往前找,找到第一个@
+1表示在@符号开始取
1000表示最大取1000个字符
select * from tet_store t where t.storename='1314';店铺
select * from tsp_goods g where g.store_id=(select id from tet_store t where t.storename='1314'); 商品
select * from tsp_goods g where g.store_id=(select id from tet_store s where s.storename='709394') and ='水杯';
select * from tetm_address;
select * from tetm_etmrefgoods;
select * from tetm_etminfo
查询金额
select *
from tet_account a
join tsso_member m on a.owner = m.id
where ername = '709394';
select *
from tsp_goods g
where g.store_id =
(select id from tet_store t where t.storename = '709394')
and isdelete = '0'
and ismarketable = '1';
select *
from tsp_product prod
left join tsp_goods gs on prod.GOODS_ID = gs.id
where gs.Store_Id = '4028807c30daa6680130df6db1ae00d8'
and gs.isdelete = '0'
and gs.ismarketable = '1'
select *
from (select t.delivery_branch_store_id
from tms_order t, tms_branch_store tbs
where t.delivery_branch_store_id = tbs.id
group by t.delivery_branch_store_id) temp
left join tms_order td on td.delivery_branch_store_id =
temp.delivery_branch_store_id
left join tms_member tm on tm.id = td.member_id;
查询tsp_product 表
select * from tsp_product prod left join tsp_goods gs on prod.GOODS_ID=gs.id where gs.Store_Id='4028807c30daa6680130df6db1ae00d8'
and prod.isdelete=0 and prod.ISMARKETABLE=1
单一查询数据库:
select prod.*
from tsp_product prod
left join tsp_goods gs on prod.GOODS_ID = gs.id
where gs.Store_Id = '4028807c30daa6680130df6db1ae00d8'
and prod.isdelete = 0
and prod.ISMARKETABLE = 1
select t.goodssn, count(*)
from tsp_goods t
where t.store_id = '4028807c30daa6680130df6db1ae00d8'
group by t.goodssn
select * from tsp_goods g where g.store_id=(select id from tet_store s where s.storename='709394')
…… 此处隐藏:1453字,全部文档内容请下载后查看。喜欢就下载吧 ……相关推荐:
- [资格考试]石油钻采专业设备项目可行性研究报告编
- [资格考试]2012-2013学年度第二学期麻风病防治知
- [资格考试]道路勘测设计 绪论
- [资格考试]控烟戒烟知识培训资料
- [资格考试]建设工程安全生产管理(三类人员安全员
- [资格考试]photoshop制作茶叶包装盒步骤平面效果
- [资格考试]授课进度计划表封面(09-10下施工)
- [资格考试]麦肯锡卓越工作方法读后感
- [资格考试]2007年广西区农村信用社招聘考试试题
- [资格考试]软件实施工程师笔试题
- [资格考试]2014年初三数学复习专练第一章 数与式(
- [资格考试]中国糯玉米汁饮料市场发展概况及投资战
- [资格考试]塑钢门窗安装((专项方案)15)
- [资格考试]初中数学答题卡模板2
- [资格考试]2015-2020年中国效率手册行业市场调查
- [资格考试]华北电力大学学习实践活动领导小组办公
- [资格考试]溃疡性结肠炎研究的新进展
- [资格考试]人教版高中语文1—5册(必修)背诵篇目名
- [资格考试]ISO9001-2018质量管理体系最新版标准
- [资格考试]论文之希尔顿酒店集团进入中国的战略研
- 全国中小学生转学申请表
- 《奇迹暖暖》17-支2文学少女小满(9)公
- 2019-2020学年八年级地理下册 第六章
- 2005年高考试题——英语(天津卷)
- 无纺布耐磨测试方法及标准
- 建筑工程施工劳动力安排计划
- (目录)中国中央空调行业市场深度调研分
- 中国期货价格期限结构模型实证分析
- AutoCAD 2016基础教程第2章 AutoCAD基
- 2014-2015学年西城初三期末数学试题及
- 机械加工工艺基础(完整版)
- 归因理论在管理中的应用[1]0
- 突破瓶颈 实现医院可持续发展
- 2014年南京师范大学商学院决策学招生目
- 现浇箱梁支架预压报告
- Excel_2010函数图表入门与实战
- 人教版新课标初中数学 13.1 轴对称 (
- Visual Basic 6.0程序设计教程电子教案
- 2010北京助理工程师考试复习《建筑施工
- 国外5大医疗互联网模式分析




