473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

logic error

Declare @mx int
Set @mx = (select max(score)
from ,,,
where ,,,,and
substring(city,1,1)='g')

select score,@mx
from ,,,,
where ,,,, and
substring(city,1,1)='g')
group by score
go

this seems to work for small tables
but when table is big and substring(city,1,1)='g')
condition is not met it takes aweful time like goes
in an infinit loop.


--
Sent by 3 from yahoo part of com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com
Jul 20 '05 #1
1 1432
oj
that's because substring(city,1,1)='g') forces a table scan even if there is
an index on city. the alternative is to use

city like 'g%'

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net
"al********@yahoo.com" <u1********@spawnkill.ip-mobilphone.net> wrote in
message news:l.*********************@[63.127.215.130]...
Declare @mx int
Set @mx = (select max(score)
from ,,,
where ,,,,and
substring(city,1,1)='g')

select score,@mx
from ,,,,
where ,,,, and
substring(city,1,1)='g')
group by score
go

this seems to work for small tables
but when table is big and substring(city,1,1)='g')
condition is not met it takes aweful time like goes
in an infinit loop.


--
Sent by 3 from yahoo part of com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
2
by: Thiko | last post by:
I have a sql server automatic job set up containing 2 steps. First step is an Operating System Command (CmdExec) type job which runs a .bat file which copies across a backup file to this machine....
0
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
0
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. "Exception are divided into logic errors and...
1
by: Irritable Bowel Syndrome | last post by:
Just finished off a production .NET web application written in c#. I set up a error handler in the global.asax which is triggered to iterate through the error stack and send it and other...
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
8
by: - | last post by:
Hi to All, To reproduce: The expression: object result = flag ? (long) 0 : (double) 0; always evaluated as a double... see dissassembly to ensure the bad compiled code.
1
by: Vaibhav Modak | last post by:
Hi All, I have a Web Service written in Java (Web Logic) and I am trying to call it in my ASP. NET client. I am facing a problem while getting the data from the Web Service Method. My Web...
4
by: Mike | last post by:
I have an n-tier system as follows: Business Data Access Web Services
7
by: ashjas | last post by:
Hello, I have run this logic on turboc++ 3.0 and it is working fine on it but its not running on msvs2008 c++. i am not able to assign the value like this *temp=*main,where main and temp are char...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.