ADawn
asked on
SQL Statement: CountOfSummaryItem
Hello All,
Is there anyway to ASC, DESC the CountOfSummaryItem in this sql?:
s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
(Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor;"
Thanks guys. ADawn
Is there anyway to ASC, DESC the CountOfSummaryItem in this sql?:
s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
(Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor;"
Thanks guys. ADawn
ASKER
rajaamirapu
I've tried this. It doesn't work! I receive the error message:
"No value given for one or maore required parameters."
I've tried this. It doesn't work! I receive the error message:
"No value given for one or maore required parameters."
Or
s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
(Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor, CountOfSummaryItem DESC;"
s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
(Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor, CountOfSummaryItem DESC;"
How are you using this sql statement? Is it part of a data environment for example?
ASKER
carpe-diem
Same error message:
"No value given for one or maore required parameters."
ADawn
Same error message:
"No value given for one or maore required parameters."
ADawn
Can you give the error code
s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
(Count(*)/(((Select count(*) FROM tbl_Records_DR)))) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor, CountOfSummaryItem DESC;"
Try adding extra (( )) around the subquery, I know I always use them with subqueries, otherwise errors can occur!
Don't know if this will resolve your problem.
(Count(*)/(((Select count(*) FROM tbl_Records_DR)))) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor, CountOfSummaryItem DESC;"
Try adding extra (( )) around the subquery, I know I always use them with subqueries, otherwise errors can occur!
Don't know if this will resolve your problem.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ROTRTechTeam
Thanks for the great information. However, please note that you have two Order BY clauses which caused an error. I removed Order BY DAuthor (keeping: ORDER BY Count(DAuthor)) and the SQL works great.
This comment is for others that may want to use your GREAT works!
Thanks,
ADawn
Thanks for the great information. However, please note that you have two Order BY clauses which caused an error. I removed Order BY DAuthor (keeping: ORDER BY Count(DAuthor)) and the SQL works great.
This comment is for others that may want to use your GREAT works!
Thanks,
ADawn
Whoops! I copied your SQL and added my order by at the end. Sorry about that, but thanks for the compliments! Glad it worked for you!
(Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
From tbl_Records_DR GROUP BY DAuthor Order BY CountOfSummaryItem;"