一个查询 大神来帮帮我

时间:2022-03-29 04:52:35
一个查询 大神来帮帮我
如图所示:
表以表格方式进行数据显示,数据列分别是:省份、地市、区县,每列中的数字表示了商户数量。

一张表的字段:
 id,商户名,省份ID,城市ID,区县ID 

数据库是Oracle 服务器控件绑定 Repeater;

怎么实现呢 些sql语句也行差不多/谢谢

7 个解决方案

#1


。。。自己定 。是生生死死 

#2


有人给个思路吗  

#3


Repearter套Repearter

#4


Sql语句:
select Province,City,Town,COUNT(1) as custcounts 
from t_cust
group by Province,City,Town

provice 省份
city 城市 
town 县
count(1) 商户数量

大致就是这样

#5


引用 3 楼 a407121393 的回复:
Repearter套Repearter
  感觉可行啊。
用三个Repearter 吗 谢谢

#6


个人感觉  全部循环出来  然后JS合并

#7


<!doctype html>
<html>
<head>
    <title>content</title>
    <style type="text/css">
        table, td { border: 1px solid #bbb; border-collapse: collapse; }
    </style>
    <script src="Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var rel = null;
            var count = 0;
            $("tr td[rel^='p']").each(function () {
                if (rel == null) {
                    rel = $(this).attr("rel");
                }
                if (rel == $(this).attr("rel")) {
                    count++;
                }
                else {
                    rel = $(this).attr("rel");
                    count = 1;
                }
                $("tr td[rel='" + rel + "']:eq(0)").attr("rowspan", count);
                $("tr td[rel='" + rel + "']:gt(0)").remove();
            })
            $("tr td[rel^='c']").each(function () {
                if (rel == null) {
                    rel = $(this).attr("rel");
                }
                if (rel == $(this).attr("rel")) {
                    count++;
                }
                else {
                    rel = $(this).attr("rel");
                    count = 1;
                }
                $("tr td[rel='" + rel + "']:eq(0)").attr("rowspan", count);
                $("tr td[rel='" + rel + "']:gt(0)").remove();
            })
            $("tr td[rel^='d']").each(function () {
                if (rel == null) {
                    rel = $(this).attr("rel");
                }
                if (rel == $(this).attr("rel")) {
                    count++;
                }
                else {
                    rel = $(this).attr("rel");
                    count = 1;
                }
                $("tr td[rel='" + rel + "']:eq(0)").attr("rowspan", count);
                $("tr td[rel='" + rel + "']:gt(0)").remove();
            })
        })
    </script>
</head>
<body>
    <table border="0" cellpadding="10" cellspacing="0">
        <tr>
            <td rel="p1">广东省</td>
            <td rel="c1_1">阳江市</td>
            <td rel="d1_1_1">江城区</td>
        </tr>
        <tr>
            <td rel="p1">广东省</td>
            <td rel="c1_1">阳江市</td>
            <td rel="d1_1_2">阳春县</td>
        </tr>
        <tr>
            <td rel="p2">广西省</td>
            <td rel="c1_2">柳州市</td>
            <td rel="d1_1_3">柳中区</td>
        </tr>
        <tr>
            <td rel="p2">广西省</td>
            <td rel="c1_3">南宁市</td>
            <td rel="d1_1_4">兴宁区</td>
        </tr>
    </table>
</body>
</html>

#1


。。。自己定 。是生生死死 

#2


有人给个思路吗  

#3


Repearter套Repearter

#4


Sql语句:
select Province,City,Town,COUNT(1) as custcounts 
from t_cust
group by Province,City,Town

provice 省份
city 城市 
town 县
count(1) 商户数量

大致就是这样

#5


引用 3 楼 a407121393 的回复:
Repearter套Repearter
  感觉可行啊。
用三个Repearter 吗 谢谢

#6


个人感觉  全部循环出来  然后JS合并

#7


<!doctype html>
<html>
<head>
    <title>content</title>
    <style type="text/css">
        table, td { border: 1px solid #bbb; border-collapse: collapse; }
    </style>
    <script src="Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var rel = null;
            var count = 0;
            $("tr td[rel^='p']").each(function () {
                if (rel == null) {
                    rel = $(this).attr("rel");
                }
                if (rel == $(this).attr("rel")) {
                    count++;
                }
                else {
                    rel = $(this).attr("rel");
                    count = 1;
                }
                $("tr td[rel='" + rel + "']:eq(0)").attr("rowspan", count);
                $("tr td[rel='" + rel + "']:gt(0)").remove();
            })
            $("tr td[rel^='c']").each(function () {
                if (rel == null) {
                    rel = $(this).attr("rel");
                }
                if (rel == $(this).attr("rel")) {
                    count++;
                }
                else {
                    rel = $(this).attr("rel");
                    count = 1;
                }
                $("tr td[rel='" + rel + "']:eq(0)").attr("rowspan", count);
                $("tr td[rel='" + rel + "']:gt(0)").remove();
            })
            $("tr td[rel^='d']").each(function () {
                if (rel == null) {
                    rel = $(this).attr("rel");
                }
                if (rel == $(this).attr("rel")) {
                    count++;
                }
                else {
                    rel = $(this).attr("rel");
                    count = 1;
                }
                $("tr td[rel='" + rel + "']:eq(0)").attr("rowspan", count);
                $("tr td[rel='" + rel + "']:gt(0)").remove();
            })
        })
    </script>
</head>
<body>
    <table border="0" cellpadding="10" cellspacing="0">
        <tr>
            <td rel="p1">广东省</td>
            <td rel="c1_1">阳江市</td>
            <td rel="d1_1_1">江城区</td>
        </tr>
        <tr>
            <td rel="p1">广东省</td>
            <td rel="c1_1">阳江市</td>
            <td rel="d1_1_2">阳春县</td>
        </tr>
        <tr>
            <td rel="p2">广西省</td>
            <td rel="c1_2">柳州市</td>
            <td rel="d1_1_3">柳中区</td>
        </tr>
        <tr>
            <td rel="p2">广西省</td>
            <td rel="c1_3">南宁市</td>
            <td rel="d1_1_4">兴宁区</td>
        </tr>
    </table>
</body>
</html>