RE: Result fast

RE: Result fast

 

  

Use better code structure.

Select A.* < only use columns that you need not *
from A < use owner dbo.A
Inner join b on a.col1=b.col1
where (b.col2 in (A,b,c) or a.col2 in (Q,R,S)) and (a.col3 =2 and b.col4=8)
other wise this would be fine.

PAYCHEX
Christopher Bellizzi
Information Technology * Database Administration
675 Basket Road * Webster, New York 14580
(585) 216-0670 * [Email address protected]

-----Original Message-----
From: Milind Amin [mailto:mssqldba-ezmlmshield-x7708741.[Email address protected]
Sent: Thursday, December 27, 2007 5:26 AM
To: LazyDBA Discussion
Subject: RE: Result fast

Third one is fine. Here I put bracket in where condition.

Select A.* from A
Inner join b on a.col1=b.col1
where (b.col2 in (A,b,c) or a.col2 in (Q,R,S)) and (a.col3 =2 and b.col4=8)

 
Milind. B. Amin
Module Leader
TechProcess Solution Ltd.
Mumbai
milind.[Email address protected]
http://www.techprocess.co.in
Ph: 022-6652-8612
Mobile: 91-9819916106


-----Original Message-----
From: J.Saraboji
[mailto:mssqldba-ezmlmshield-x39839482.[Email address protected]
Sent: Thursday, December 27, 2007 12:34 PM
To: LazyDBA Discussion
Subject: Result fast






Dear All,



I wrote a query like following query method but which is
correct? In where condition which should come first?

Please explain some one.





Select A.* from a,b

Where a.col1=b.col1 and b.col2 in (A,b,c) or a.col2 in (Q,R,S)
and a.col3 =2 and b.col4=8





Select A.* from A

Inner join b on a.col1=b.col1 and b.col2 in (A,b,c) or a.col2 in
(Q,R,S) and a.col3 =2 and b.col4=8



Select A.* from A

Inner join b on a.col1=b.col1

where b.col2 in (A,b,c) or a.col2 in (Q,R,S) and a.col3 =2 and b.col4=8





I need fast result.





Thanks & Regards,

JSaraboji,

MSSQL - DBA Direction Software Solutions,

Contact : +91 22 66615000. EXT 336

E-Mail : j.[Email address protected]





---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html


The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments contained in it.

Contact your Administrator for further information.


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




-----------------------------------------
The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Thank you. Paychex, Inc.

MS Sql Server LazyDBA home page