Solved

Getting Count(*) into a varibale

Posted on 2013-12-05
2
268 Views
Last Modified: 2013-12-05
Experts,

here is my sample code and have tried multiple options and couldn't get it worked to assign the count(*)  to my variable so that I can use that value for later


Declare @@Total

SELECT @Total  = count(*) FROM (
SELECT  T1.ItemID
FROM MyDatabase..MyTable T1
INNER JOIN
INNER JOIN
INNER JOIN
...
WHERE
GROUP BY T1.ItemID
      HAVING  
)
 

Thanks in advance.
0
Comment
Question by:Tpaul_10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 200 total points
ID: 39699439
Declare @Total int

SELECT @Total  = count(*) FROM (
SELECT  T1.ItemID
FROM MyDatabase..MyTable T1
INNER JOIN
INNER JOIN
INNER JOIN
...
WHERE
GROUP BY T1.ItemID
      HAVING  
)A
0
 

Author Closing Comment

by:Tpaul_10
ID: 39699458
Thank You Aneeshattingal, appreciate your quick help
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question