zoukankan      html  css  js  c++  java
  • sql统计

      SELECT TOP 1000 a.[Title]as 第一级,b.[Title] as 第二级
          ,c.[Title] as 第三级, s.总数 as 总数
      FROM [MyAli].[dbo].[AL_Charpt] as c
      inner join  AL_Book as b on c.bookid=b.id
      inner join AL_Category as a  on b.[ParentID]= a.id
      inner join AL_Article as art on art.ChartpID=c.id
      inner join (select count(*) as 总数, ArticleID as 分类 FROM [MyAli].[dbo].[AL_ProductList] where id not in(select productListid from GenerateProductList where ArticleID<=379) and ArticleID<=379 group by ArticleID) as s on art.id=s.分类
          where c.id in (71,
    66,
    67,
    202,
    75,
    197,
    55,
    58,
    54,
    79,
    77,
    56,
    20,
    63,
    24,
    74,
    76,
    175,
    86,
    84,
    209,
    78,
    254,
    255,
    211,
    62,
    64,
    80,
    206,
    195,
    70,
    68,
    17,
    134,
    25,
    252,
    188,
    171,
    73,
    240,
    186,
    14,
    18,
    237,
    65,
    160,
    205,
    210,
    249,
    241,
    342,
    338,
    5,
    239,
    169,
    248,
    98,
    45,
    2,
    346,
    343,
    251,
    50,
    31,
    192,
    61,
    341,
    4,
    81,
    257,
    253,
    12,
    33,
    245,
    38,
    99,
    13,
    41,
    23,
    69,
    43,
    324,
    159,
    187,
    59,
    3,
    89,
    168,
    60,
    27,
    216,
    190,
    250,
    82,
    170,
    212,
    1,
    323,
    238,
    319,
    48,
    53,
    198,
    51,
    204,
    345,
    52,
    85,
    131,
    215,
    242,
    213,
    39,
    214,
    194,
    243,
    15,
    135,
    322,
    44,
    46,
    177,
    137,
    320,
    246,
    130,
    200,
    35,
    337,
    327,
    347,
    261,
    344,
    95,
    339,
    28,
    329,
    334,
    94,
    260,
    189,
    91,
    90,
    92,
    271,
    328,
    133,
    164,
    208,
    11,
    157,
    352,
    263,
    199,
    203,
    191,
    72,
    88,
    302,
    330,
    29,
    305,
    307,
    268,
    180,
    276,
    207,
    97,
    321,
    280,
    141,
    361,
    335,
    142,
    178,
    317,
    163,
    6,
    247,
    93,
    229,
    10,
    349,
    47,
    286,
    340,
    132,
    310,
    332,
    331,
    351,
    176,
    138,
    308,
    36,
    256,
    219,
    96,
    32,
    333,
    165,
    374,
    298,
    278,
    313,
    259,
    8,
    125,
    167,
    309,
    217,
    153,
    162,
    376,
    244,
    161,
    306,
    375,
    166,
    315,
    281,
    373,
    158,
    277,
    155,
    57,
    22,
    354,
    367,
    182,
    288,
    224,
    196,
    312,
    143,
    267,
    226,
    231,
    220,
    363,
    316,
    291,
    292,
    285,
    362,
    300,
    360,
    314,
    235,
    325,
    290,
    144,
    146,
    223,
    181,
    269,
    193,
    9,
    311,
    184,
    358,
    364,
    372,
    151,
    365,
    154,
    227,
    101,
    294,
    369,
    265,
    112,
    110,
    185,
    378,
    366,
    355,
    282,
    270,
    336,
    289,
    7,
    37,
    111,
    16,
    115,
    183,
    304,
    124,
    136,
    30,
    228,
    116,
    233,
    356,
    326,
    284,
    173,
    370,
    258,
    113,
    148,
    377,
    145,
    34,
    218,
    287,
    357,
    174,
    179,
    114,
    262,
    230,
    266,
    353,
    172,
    19,
    303,
    156,
    297,
    232,
    350,
    293,
    119,
    126,
    275,
    279,
    301,
    128,
    140,
    118,
    40,
    274,
    221,
    296,
    147,
    21,
    236,
    299,
    201,
    318,
    100,
    273,
    117,
    103,
    102,
    359,
    149,
    272,
    139,
    26,
    234,
    109,
    150,
    371,
    107,
    127,
    225,
    283,
    264,
    106,
    108,
    368,
    104,
    105)
          order by s.总数 desc

  • 相关阅读:
    Qt: 自动调整到最合适的大小(不是很明白)
    Qt: 读写二进制文件(写对象, 原始数据等)
    Qt: 把内容写进字符串中与C++很相似(使用QTextStream包装QString)
    2008技术内幕:T-SQL语言基础
    bootstrap + angularjs + seajs构建Web Form前端2
    SignalR 2.0 系列: SignalR简介
    Amazon前技术副总裁解剖完美技术面试
    MongoDB数据文件内部结构
    SQL Server三种表连接原理
    了解mongoDB存储结构
  • 原文地址:https://www.cnblogs.com/guozhe/p/3148807.html
Copyright © 2011-2022 走看看