数据库查询语句(DBA).doc_第1页
数据库查询语句(DBA).doc_第2页
数据库查询语句(DBA).doc_第3页
数据库查询语句(DBA).doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

select c.path from tsp_goodscategory c where = 联想笔记本;select as 分类名称, t.goodsquantity as 商品总数量, t.sellgoodsquantity as 可卖商品数量 from tsp_goodscategory t where instr(4028807c33b057770133b0a2967d0017,4028807c33b057770133b0a342a30019,4028807c33b057770133b0a7d851001f, t.id, 1, 1) 0;INSTR(C1,C2,I,J) 在一个字符串中搜索指定的字符,返回发现指定的字符的位置;C1 被搜索的字符串C2 希望搜索的字符串I 搜索的开始位置,默认为1J 出现的位置,默认为1SQL 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.idwhereg.store_id=(selectidfromtet_storetwheret.storename=709394)andp.isdelete=0andp.ismarketable=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 (139.com,,126.com,163.com,21) 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 m.username = 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 = 1select * 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

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论