x

can you please suggest how to optimize this query : select a.col1,a.col2,count(b.col1) as cnt from table1 a,table2 b where b.col2 between a.col1 and a.col2 group by a.col1,a.col2

can you please suggest how to optimize this query : select a.col1,a.col2,count(b.col1) as cnt from table1 a,table2 b where b.col2 between a.col1 and a.col2 group by a.col1,a.col2

more ▼

asked Mar 17 at 07:45 AM in Default

avatar image

pavithra_vs
1

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Look at your ex.plan and set statists io on to see with table has the most logical reads

more ▼

answered Mar 19 at 01:58 PM

avatar image

borispinsky
1 1

(comments are locked)
10|1200 characters needed characters left

your understanding of the requirement must be wrong. Try to understand what result you need to generate.

more ▼

answered Mar 19 at 10:22 PM

avatar image

vvvtrain
31 1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x70
x46
x21
x5

asked: Mar 17 at 07:45 AM

Seen: 32 times

Last Updated: Mar 19 at 10:22 PM

Copyright 2016 Redgate Software. Privacy Policy