Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need efficient Query

Author  Topic 

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-12 : 09:44:06
This query is giving me very slow search .What could be the efficient way


SELECT (
SELECT COUNT(applicationID) FROM Vw_rptBranchOffice
WHERE ( statusDate between '2008-03-13 16:12:11.513' AND '2008-05-30 00:00:00.000'
AND SearchString like '%del%')) AS
totalNO,ApplicationID,SearchString,StudentName,IntakeID,CounslrStatusDate
FROM Vw_rptBranchOffice
WHERE statusDate between '2008-03-13 16:12:11.513' AND '2008-05-30 00:00:00.000' AND
SearchString like '%del%'

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 09:46:21
Are trying to show the total count along with detail rows?
Go to Top of Page

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-12 : 09:52:33
yes .

I want total value of aplicationID through count and with the row wise detail as the same time
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-06-12 : 10:03:29
I think this query will also get you the same resultset as your original query.


SELECT COUNT(applicationID) AS totalNO FROM Vw_rptBranchOffice
,ApplicationID,SearchString,StudentName,IntakeID,CounslrStatusDate
FROM Vw_rptBranchOffice
WHERE statusDate between '2008-03-13 16:12:11.513' AND '2008-05-30 00:00:00.000' AND
SearchString like '%del%'.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-12 : 10:38:23
[code]SELECT COUNT(applicationID) OVER () AS totalNO,
applicationID,
searchString,
studentName,
intakeID,
counslrStatusDate
FROM vw_rptBranchOffice
WHERE statusDate BETWEEN '2008-03-13 16:12:11.513' AND '2008-05-30 00:00:00.000'
AND SearchString LIKE '%del%'[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-13 : 01:21:53
Thanx Peso,

Your query takes 10 seconds less than mine.
Go to Top of Page
   

- Advertisement -