Quick Search


Tibetan singing bowl music,sound healing, remove negative energy.

528hz solfreggio music -  Attract Wealth and Abundance, Manifest Money and Increase Luck



 
Your forum announcement here!

  Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums > Other Methods of FREE Advertising > Manual Traffic Exchanges

Manual Traffic Exchanges This is a list of Manual traffic exchanges that you can use to get your site viewed by thousands of people a week. Manual traffic exchanges are better known for quality over the quantity you find with auto surfs. But both are great for generating traffic.

Reply
 
Thread Tools Search this Thread Display Modes
Old 04-05-2011, 05:11 PM   #1
sheshe42
 
Posts: n/a
Default Discount Office 2007 Writing a Count(Distinct) Que

We received a question from a reader named Eric week before last about how to write a Count(Distinct) query in Access. In other database applications such as SQL Server, Oracle, and MySQL, the Count(Distinct) aggregate is used to count the number of unique items in a given rowset. For example, consider a table on SQL Server named tblColors, such as: ColorValue Red5 Green2 Blue8 Orange1 Red8 Green6 Blue2To get a count of the number of unique colors in the table, you could write a query such as:SELECT Count(Distinct Color) AS N FROM tblColorsThis would return the value 4 as there are four unique colors in the Color field in the table. Unfortunately, the Access Database Engine does not support the Count(Distinct) aggregate. To return this value from an Access table, you would need to use a subquery such as:SELECT Count(*) AS N
FROM
(SELECT DISTINCT Color FROM tblColors) AS T;Now let's say that you also want to include another aggregate value such as a Sum, and want to group by some value, in this case,microsoft Office 2010 Activation, Color. On SQL Server,Windows 7 Activation, you could write this query as:SELECT Color, Sum(Value) AS Total, Count(Distinct Color) AS N
FROM tblColors
GROUP BY ColorThis provides the following results: ColorTotalN Blue101 Green81 Orange11 Red131 Now, if you're asking whether or not this should return the value of '1', the answer is yes. As I understand it, the Count(Distinct) here can be used as a test to verify the results of a given query.If your data is on a server that supports Count(Distinct), you might be able to use a pass-through query to retrieve the results. If you are working with Access data, this becomes a bit more challenging.Since we used subqueries for the previous query,Discount Office 2007, we'll need to do the same here. The trick however is that we need to use two subqueries as shown in the following SQL:SELECT C.Color, Sum(C.Value) AS Total, T2.N
FROM
(SELECT T.Color,Office Pro 2010 Key, Count(T.Color) AS N
FROM
(SELECT DISTINCT Color,Office Professional 2007 Key, Count(*) AS N
FROM tblColors GROUP BY Color) AS T
GROUP BY T.Color) AS T2
INNER JOIN tblColors AS C
ON T2.Color = C.Color
GROUP BY C.Color, T2.N;You'll recognize the inner-most subquery as the subquery we used in the initial problem. This is then rolled into the outer-most subquery to return the number of colors per group.Thanks to Eric for the question and to Michael Tucker on the Access test team for the help! <div
  Reply With Quote

Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 08:57 AM.

 

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum