Click here to Skip to main content
16,004,906 members
Home / Discussions / Database
   

Database

 
GeneralADO.NET - BindingContext and Disappearing Rows Pin
mikasa6-Jul-04 8:54
mikasa6-Jul-04 8:54 
GeneralArabic to English Conversion Pin
Anonymous6-Jul-04 7:13
Anonymous6-Jul-04 7:13 
Generaloverwite/add between two databases help Pin
Anonymous6-Jul-04 3:51
Anonymous6-Jul-04 3:51 
Questioncan anyone optimize this query Pin
xcavin6-Jul-04 3:15
xcavin6-Jul-04 3:15 
AnswerRe: can anyone optimize this query Pin
RichardGrimmer6-Jul-04 4:12
RichardGrimmer6-Jul-04 4:12 
AnswerRe: can anyone optimize this query Pin
Michael Potter6-Jul-04 7:28
Michael Potter6-Jul-04 7:28 
GeneralRe: can anyone optimize this query Pin
xcavin6-Jul-04 19:27
xcavin6-Jul-04 19:27 
GeneralRe: can anyone optimize this query Pin
xcavin6-Jul-04 20:03
xcavin6-Jul-04 20:03 
Dear Michael,

So i modified my query like this

select *
from pending
where custid <> '' and
custid in (
select id from customer
where status=1 and
priority = (
select max(priority) from customer
where id in (
select distinct custid from pending
where custid <> ''
)
)
)

and your query.

SELECT pending.*
FROM pending
INNER JOIN customer cus ON (pending.custid = cus.id)
WHERE pending.custid <> '' AND
cus.status = 1 AND
cus.priority = (

SELECT max(priority)
FROM customer
WHERE id = pending.custid
)

But when in checked the execution plan my query was showing less percentage for all the counters there.
Where as your query is showing more.

So my doubt was, does my lazy query has any advantage or perfomance gain that i am not aware of, may be coz of not using joins.

btw still wondering how you guys are writing such optimized queries, actually i can program(c++) many complex issues, but still cannot optimize the SQL queries like that, is there any tips to get started ??

thanks
GeneralRe: can anyone optimize this query Pin
Michael Potter7-Jul-04 3:13
Michael Potter7-Jul-04 3:13 
AnswerRe: can anyone optimize this query Pin
michanne6-Jul-04 15:36
michanne6-Jul-04 15:36 
GeneralSQL connection Pin
tennis045-Jul-04 20:07
tennis045-Jul-04 20:07 
GeneralRe: SQL connection Pin
Michael Potter6-Jul-04 7:37
Michael Potter6-Jul-04 7:37 
GeneralRe: SQL connection Pin
tennis047-Jul-04 19:53
tennis047-Jul-04 19:53 
GeneralRe: SQL connection Pin
Michael Potter8-Jul-04 3:07
Michael Potter8-Jul-04 3:07 
GeneralRe: SQL connection Pin
tennis048-Jul-04 15:10
tennis048-Jul-04 15:10 
GeneralRe: SQL connection Pin
Michael Potter9-Jul-04 3:36
Michael Potter9-Jul-04 3:36 
GeneralTable name a String Pin
si_695-Jul-04 0:21
si_695-Jul-04 0:21 
GeneralRe: Table name a String Pin
michanne15-Jul-04 5:50
michanne15-Jul-04 5:50 
GeneralRe: Table name a String Pin
Grimolfr6-Jul-04 9:38
Grimolfr6-Jul-04 9:38 
Generaltext to ntext Pin
ShankarPS4-Jul-04 17:04
ShankarPS4-Jul-04 17:04 
GeneralRe: text to ntext Pin
Hesham Amin4-Jul-04 22:44
Hesham Amin4-Jul-04 22:44 
GeneralRe: text to ntext Pin
Mike Dimmick7-Jul-04 5:56
Mike Dimmick7-Jul-04 5:56 
GeneralSQL Help. Pin
brdavid4-Jul-04 14:59
brdavid4-Jul-04 14:59 
GeneralRe: SQL Help. Pin
Hesham Amin4-Jul-04 22:50
Hesham Amin4-Jul-04 22:50 
GeneralRe: SQL Help. Pin
brdavid6-Jul-04 4:49
brdavid6-Jul-04 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.