• oracle的sql积累..&..decode函数使用


    SELECT a.areaname as 二级地名 FROM houses h,houses h2,
    areas a WHERE h.areaid=a.areasid AND h2.areaid=a.areasid AND h.finalassessmentid=1 AND
    h.houseslevel=2 AND h2.houseslevel=1 AND a.areasid!=a.parentareasid AND a.companysid=2;

    select * from areas
    select count(h.houseslevel) as 总数,count(h1.houseslevel) as 最新累计成盘,count(h2.houseslevel) as 最新累计必交盘 from houses h,houses h1,houses h2 where h.houseslevel in (1,2) and h1.houseslevel=1 and h2.houseslevel=2;

    select count(h.houseslevel) as 总数 from houses h where h.houseslevel in (1,2)
    union all
    select count(h.houseslevel) as 成盘 from houses h where h.houseslevel=1
    union all
    select count(h.houseslevel) as 成盘 from houses h where h.houseslevel=2;


    select
    count(h.houseslevel) as 总数,
    count(case when h.houseslevel=1 then h.housesid end ) 成盘 ,
    count(case when h.houseslevel=2 then h.housesid end ) 比较盘
    from houses h,areas a where h.areaid=a.areasid and h.houseslevel in (1,2)

    SELECT a.areaname AS 二级地名,
    count(a.houseId) AS 最新累计有效待售数,
    count(h.houseslevel) AS 最新累计必卖盘,count(h2.houseslevel) AS 最新累计成盘 FROM houses h,houses h2,
    areas a WHERE h.areaid=a.areasid AND h2.areaid=a.areasid AND h.finalassessmentid=1 AND h.houseslevel=2 AND h2.houseslevel=1 AND a.areasid!=a.parentareasid AND a.companysid=2;

    SELECT a.areaname AS 二级地名 FROM houses h,areas a WHERE h.areaid=a.areasid AND a.areasid!=a.parentareasid

    SELECT a.areaname AS 二级地名 FROM areas a where a.areaname=

    select a.areaname AS 二级地名 from areas a
    where a.areaname in (select b.areaname from areas b group by b.areaname having count(b.areaname) > 1)


    select b.areaname as 二级地名,count(b.areaname) as 重复数据量 from areas b group by b.areaname having count(b.areaname) > 1

    select h.houseslevel from houses h where h.houseslevel=1;

    select a.areaname AS 二级地名 from houses h,areas a where h.areaid=h.areaid and h.houseslevel=1 and a.areasid!=a.parentareasid AND a.companysid=2 and h.finalassessmentid=1;


    select a.areaname AS 二级地名,
    count(h.houseslevel) as 总数,
    count(case when h.houseslevel=1 then h.housesid end ) 成盘 ,
    count(case when h.houseslevel=2 then h.housesid end ) 比较盘
    from houses h,areas a where h.areaid=a.areasid and h.houseslevel in (1,2) and a.areasid!=a.parentareasid AND a.companysid=2 and h.finalassessmentid=1 and flag1=1 group by a.areaname;

  • 相关阅读:
    代理服务器的原理及用法
    [Web前端] 给li设置float浮动属性之后,无法撑开外层ul的问题。
    [Web 前端] react-router4-0中文文档
    [Web 前端] inline-block元素设置overflow:hidden属性导致相邻行内元素向下偏移
    [Web 前端] React Js img 图片显示默认 占位符
    [Web 前端] React高级教程(es6)——(2)对于Refs最新变动的理解
    [Web 前端] 你不知道的 React Router 4
    [Web 前端] React-router4简约教程
    [Web 前端] React Router v4 入坑指南
    [Web 前端] 前端频道之团队维护、聚合、订阅
  • 原文地址:https://www.cnblogs.com/shunzdd/p/5585988.html
Copyright © 2020-2023  润新知