473,471 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make this an efficient query?

1 New Member
Is there an easier way of grouping with this type of query?

Select Distinct
left(TrackerFileName,38),
(Select Count(AccountNo) from DTVSummary where Active = 'N' and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Not_Active,
(Select Count(AccountNo) from DTVSummary where Active = 'Y' and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Active,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 1 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H' ) as Acct1,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 2 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct2,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 3 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct3,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 4 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct4,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 5 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct5,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 6 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct6,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 7 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct7,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 8 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct8,
(Select Count(AccountNo) from DTVSummary where AttemptQty = 9 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct9,
(Select Count(AccountNo) from DTVSummary where AttemptQty >=10 and TrackerFileName = 'FC200608267912.CompMkt_Cvs3H') as Acct10
From DTVSummary
where TrackerFileName = 'FC200608267912.CompMkt_Cvs3H'
group by TrackerFileName
go
Sep 13 '06 #1
0 1060

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Belmin | last post by:
Hi all, Wanted to know what is the most efficient way of doing a select query for mysql that only returns one value. For example: $mysqli->query('select count(*) from log'); $temprec =...
6
by: John | last post by:
Just a general question... I'm currently using a combobox that when updated, opens a form with its recordset based on a query using the combo box value as the criteria. I'm I correct in...
6
by: Roy | last post by:
Hey all, I'm a relative newcomer to asp.net and have 2 simple code snippets below. Everything works fine, I'm just curious if there is a more efficient way to do the job as the update takes quite a...
2
by: anthonykallay | last post by:
Hi there, I have created a sp and function that returns amongst other things a comma seperated string of values via a one to many relationship, the code works perfectly but i am not sure how to...
4
by: ken | last post by:
Hi, I use this command to run a make table query without opening it... CurrentDb.Execute "make table query name" Access tells me that it can't execute a select query...? Its a make table query...
2
by: teser3 | last post by:
I would like to know if it is possible to do a pattern match or better way to condense my below query in Access 2003. Basically I need to query the average with all fields in TableOne that end...
5
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an...
4
by: Mark | last post by:
Hey folks, I'm looking at making the following query more efficient potentially using the ranking functions and I'd like some advice from the gurus. The purpose of the following is to have a...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
1
by: joshai | last post by:
Hi, I'm pretty new to the php/mysql world and am building an article database for a website with multiple content types. I have an entry screen built that allows the site owner to enter articles,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.