Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

need select with count

Posted on 2007-03-31
2
Medium Priority
?
172 Views
Last Modified: 2010-08-05
I have a query:
Select Distinct email, quote, product, DATE From tblTest
that generates the following type of data...
a_s@company.org      102297      prod1            2/26/2007
a_k@company.org      60448      prod2      2/8/2007
a_k@company.org      72454      prod2      2/8/2007
a_k@company.org      133024      prod2      3/19/2007
a_k@company.org      133030      prod2      3/19/2007
a_k@company.org      134622      prod2      3/20/2007
a_k@company.org      134936      prod2      3/20/2007
a_k@company.org      134981      prod2      3/20/2007
a_l@company.org      987610      prod2      2/16/2007
a_l@company.org      84018      prod1            2/9/2007
a_l@company.org      85573      prod2      2/13/2007
A_T@company.org      32334      prod2      1/14/2007
A_T@company.org      88763      prod2      3/13/2007
A_T@company.org      123372      prod2      3/22/2007
a_c@company.org      62272      prod1            1/23/2007
a_c@company.org      84560      prod3      2/9/2007
a_c@company.org      100968      prod1            2/23/2007
a_c@company.org      135166      prod3      3/20/2007
A_L@company.org      105942      prod4      2/28/2007
a_j@company.org      37878      prod2      12/28/2006

How can I get the count of distinct quotes,product,date per email in the same table? I know how to get it in a different table with email and count...
but something like this:
a_s@company.org      102297      prod1            2/26/2007      1
a_k@company.org      60448      prod2      2/8/2007      7
a_k@company.org      72454      prod2      2/8/2007      7
a_k@company.org      133024      prod2      3/19/2007      7
a_k@company.org      133030      prod2      3/19/2007      7
a_k@company.org      134622      prod2      3/20/2007      7
a_k@company.org      134936      prod2      3/20/2007      7
a_k@company.org      134981      prod2      3/20/2007      7
a_l@company.org      987610      prod2      2/16/2007      3
a_l@company.org      84018      prod1            2/9/2007      3
a_l@company.org      85573      prod2      2/13/2007      3
A_T@company.org      32334      prod2      1/14/2007      3
A_T@company.org      88763      prod2      3/13/2007      3
A_T@company.org      123372      prod2      3/22/2007      3
a_c@company.org      62272      prod1            1/23/2007      4
a_c@company.org      84560      prod3      2/9/2007      4
a_c@company.org      100968      prod1           2/23/2007      4
a_c@company.org      135166      prod3      3/20/2007      4
A_L@company.org      105942      prod4      2/28/2007      1
a_j@company.org      37878      prod2      12/28/2006      1

Is it possible even?


0
Comment
Question by:acdagirl
[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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 18829084
select t.*, ( select count(*) from tblTest i where i.email = t.email )
from tblTest t
0
 

Author Comment

by:acdagirl
ID: 18829121
I modified to to give me the fields of interest as my tblTest contains more fields, etc. that might skew the whole "distinct" thing I was looking for versus the t.* idea... I got what I needed. thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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