如何在sql中查找所有列名称的记录总数 [英] how to find total number of records with all columns name in sql
本文介绍了如何在sql中查找所有列名称的记录总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请某人告诉我们
如何在sql中查找所有列名称的记录总数
如果我运行此查询它将显示错误的输出: -
SELECT COUNT(*),CustomerId,EmployeeID ,OrderDate,ShipperID FROM Orders;
它生成写入CustomerId,EmployeeID,OrderDate,ShipperID FROM Orders
请告诉我解决方案,我需要帮助...
Pls some one tell that
how to find total number of records with all columns name in sql
like if i run this query it will show wrong output:--
SELECT COUNT(*), CustomerId,EmployeeID,OrderDate,ShipperID FROM Orders;
it generate wrote CustomerId,EmployeeID,OrderDate,ShipperID FROM Orders
Pls tell me the solution, i need help...
推荐答案
奇怪的请求......但这并不困难。您显示的代码不起作用 - COUNT函数创建一个隐式GROUP BY,它不包含其他列,因此您也不能返回它们。尝试:
Strange request... But it's not difficult. The code you show will not work - the COUNT function creates an implicit GROUP BY which does not include the oother columns, so you can't return them as well. Try:
SELECT (SELECT COUNT(*) FROM Orders) AS [Count], CustomerId,EmployeeID,OrderDate,ShipperID FROM Orders
这篇关于如何在sql中查找所有列名称的记录总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文