select count(*)什么都不显示(不是空值,什么都不是)

时间:2018-02-08 10:03:27

标签: sql-server count no-data

当我运行以下查询时,我什么也得不到。不是空值,但没有the image is not cutoff right after (no column name) there is nothing there(图像没有被切断(没有列名),没有任何东西)。

如果我摆脱了最后一个AND子句,我会得到一个数字(即使该数字为零),如果我在NOT IN括号内运行查询,我得到了预期的结果。如果我用NOT IN括号中的查询替换我从该查询得到的结果,它将给我正确的数字。

我希望它说0而不是什么。 COALESCE和ISNULL不起作用,因为没有返回null值,似乎没有返回任何内容。

SELECT count(*)
FROM groups g  
    INNER JOIN item_group ig ON g.groupid = ig.groupid  
    INNER JOIN item_materiel im ON ig.itemid = im.item_id  
WHERE g.groupid = 4933  
     AND im.ItemMateriel_ID NOT IN (  
                         SELECT oim.ItemMaterielID  
                         FROM groups g  
                         INNER JOIN item_group ig ON g.groupid = ig.groupid  
                         INNER JOIN orderitem oi ON ig.itemid = oi.itemid  
                         INNER JOIN OrderItemMateriel oim ON oi.OrderItemID 
                                      = oim.OrderItemID  
                         WHERE g.groupid = 4933  
                                    )  
GROUP BY g.groupid 

1 个答案:

答案 0 :(得分:2)

您需要删除const webpack = require('webpack'); const helpers = require('./helpers'); const DefinePlugin = require('webpack/lib/DefinePlugin'); const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlElementsPlugin = require('./html-elements-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin'); const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin'); const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin'); const ngcWebpack = require('ngc-webpack'); const buildUtils = require('./build-utils'); module.exports = function (options) { const isProd = options.env === 'production'; const METADATA = Object.assign({}, buildUtils.DEFAULT_METADATA, options.metadata || {}); const ngcWebpackConfig = buildUtils.ngcWebpackSetup(isProd, METADATA); const supportES2015 = buildUtils.supportES2015(METADATA.tsConfigPath); const entry = { polyfills: './src/polyfills.browser.ts', vendor: './src/vendor.browser.ts', main: './src/main.browser.ts' }; Object.assign(ngcWebpackConfig.plugin, { tsConfigPath: METADATA.tsConfigPath, mainPath: entry.main }); return { performance: { hints: false }, entry: entry, resolve: { mainFields: [ ...(supportES2015 ? ['es2015'] : []), 'browser', 'module', 'main' ], extensions: ['.ts', '.js', '.json'], modules: [helpers.root('src'), helpers.root('node_modules')], alias: buildUtils.rxjsAlias(supportES2015) }, module: { rules: [ ...ngcWebpackConfig.loaders, { test: /\.scss$/, use: ['raw-loader', 'sass-loader'] }, { test: /\.(woff2?|ttf|eot|svg)$/, use: 'url?limit=10000&name=[name].[ext]' }, { test: /bootstrap\/dist\/js\/umd\//, use: 'imports?jQuery=jquery' }, { test: /\.css$/, use: ['to-string-loader', 'css-loader'] }, { test: /\.html$/, use: 'raw-loader', exclude: [helpers.root('src/index.html')] }, { test: /\.(jpg|png|gif)$/, use: 'file-loader' } ], }, plugins: [ new DefinePlugin({ 'ENV': JSON.stringify(METADATA.ENV), 'HMR': METADATA.HMR, 'AOT': METADATA.AOT, 'process.env.ENV': JSON.stringify(METADATA.ENV), 'process.env.NODE_ENV': JSON.stringify(METADATA.ENV), 'process.env.HMR': METADATA.HMR, 'process.env.API_URL': JSON.stringify(METADATA.API_URL) }), new CommonsChunkPlugin({ name: ['polyfills', 'vendor'].reverse() }), new CommonsChunkPlugin({ minChunks: Infinity, name: 'inline' }), new CommonsChunkPlugin({ name: 'main', async: 'common', children: true, minChunks: 2 }), new CopyWebpackPlugin([{ from: 'src/assets', to: 'assets' }]), new HtmlWebpackPlugin({ template: 'src/index.html', title: METADATA.title, chunksSortMode: function (a, b) { const entryPoints = ["inline","polyfills","sw-register","styles","vendor","main"]; return entryPoints.indexOf(a.names[0]) - entryPoints.indexOf(b.names[0]); }, metadata: METADATA, inject: 'body', xhtml: true, minify: isProd ? { caseSensitive: true, collapseWhitespace: true, keepClosingSlash: true } : false }), new ScriptExtHtmlWebpackPlugin({ sync: /inline|polyfills|vendor/, defaultAttribute: 'async', preload: [/polyfills|vendor|main/], prefetch: [/chunk/] }), new webpack.ProvidePlugin({ jQuery: 'jquery', $: 'jquery', jquery: 'jquery', 'window.jQuery': 'jquery', Popper: 'popper.js/dist/umd/popper.js', Hammer: 'hammerjs/hammer', Rickshaw: 'rickshaw', moment: 'moment', fullCalendar: 'fullcalendar', Raphael: 'webpack-raphael', 'window.Raphael': 'webpack-raphael', Skycons: 'skycons/skycons', Dropzone: 'dropzone', tinymce: 'tinymce/tinymce.js' }), new HtmlElementsPlugin({ headTags: require('./head-config.common') }), new LoaderOptionsPlugin({}), new ngcWebpack.NgcWebpackPlugin(ngcWebpackConfig.plugin), new InlineManifestWebpackPlugin(), ], node: { global: true, crypto: 'empty', process: true, module: false, clearImmediate: false, setImmediate: false } }; } 。由于您只选择了一个groupid,因此无论如何都将其分组是没有意义的。