unclehobart
New Member
whoa.. even his handle is a verboten word? geez.
Shadowfax said:I'm still on top of LL
hm, for me it looks neater just like that in lowercase personal preference I guessI agree with fury on the SQL thing btw, SQL commands in caps is sooo much easier when you're reviewing your own code after 6 months...
Oracle is very stable, very powerful, and very neat. I work with it on Sun Enterprise servers. At home I have an Oracle server, but the windows one just isn't the UNIX one. MySQL fucks up my queries too much. I had one query that had 13 nested selects in each other (highly highly optimized on Oracle) that took under 0.5 seconds to run on Oracle, but well over 23 minutes on MySQL.Never tried Sybase, Oracle is too expensive for me, Interbase is quite nice but I never worked with it for long, MySQL just rules. It may not have the most features, but it's easy, portable, supported by most hosts, and works great with Delphi
Hm that might be why the query never finished. I pulled the plug after 23 minutes. Duh, I'm stupid. I write nested selects ALL THE TIME and can't live without it.fury said:Duh, MySQL doesn't even have subselects
Yup, you're now between GOD and DuronClocker with 16.1290 average replies per thread started.unclehobart said:Rerun it.. I think I might have jumped about 3 slots in the last 15 min.
select distinct a.target, b.region, b.country
from typeEntries a, locations b
where a.origination =
(select distinct a.origination
from typeEntries a, locations b
where a.origination = b.Location and a.r_type =
(select distinct a.r_type
from services a, types b
where a.r_type = b.r_type and a.masterlistID =
(select masterlistID from masterlists where DisplaySequence =
(select min(DisplaySequence) from masterlists)) and a.siServiceTypeId =
(select siServiceTypeId from services where DisplaySequence =
(select min(DisplaySequence) from services) and masterlistID =
(select masterlistID from masterlists where DisplaySequence =
(select min(DisplaySequence) from masterlists)))
and a.DisplaySequence =
(select min(DisplaySequence) from types
where masterlistID =
(select masterlistID from masterlists where DisplaySequence =
(select min(DisplaySequence) from masterlists)))))
and a.r_type =
((select distinct a.r_type
from services a, types b
where a.r_type = b.r_type and a.masterlistID =
(select masterlistID from masterlists where DisplaySequence =
(select min(DisplaySequence) from masterlists)) and a.siServiceTypeId =
(select siServiceTypeId from services where DisplaySequence =
(select min(DisplaySequence) from services) and masterlistID =
(select masterlistID from masterlists where DisplaySequence =
(select min(DisplaySequence) from masterlists)))
and a.DisplaySequence =
(select min(DisplaySequence) from types
where masterlistID =
(select masterlistID from masterlists where DisplaySequence =
(select min(DisplaySequence) from masterlists)))))
and a.target = b.Location
order by country, region
Its hypnotic... almost like a lava lamp.LastLegionary said:This is what I'm talking about:
Code:select distinct a.target, b.region, b.country from typeEntries a, locations b where a.origination = (select distinct a.origination from typeEntries a, locations b where a.origination = b.Location and a.r_type = (select distinct a.r_type from services a, types b where a.r_type = b.r_type and a.masterlistID = (select masterlistID from masterlists where DisplaySequence = (select min(DisplaySequence) from masterlists)) and a.siServiceTypeId = (select siServiceTypeId from services where DisplaySequence = (select min(DisplaySequence) from services) and masterlistID = (select masterlistID from masterlists where DisplaySequence = (select min(DisplaySequence) from masterlists))) and a.DisplaySequence = (select min(DisplaySequence) from types where masterlistID = (select masterlistID from masterlists where DisplaySequence = (select min(DisplaySequence) from masterlists))))) and a.r_type = ((select distinct a.r_type from services a, types b where a.r_type = b.r_type and a.masterlistID = (select masterlistID from masterlists where DisplaySequence = (select min(DisplaySequence) from masterlists)) and a.siServiceTypeId = (select siServiceTypeId from services where DisplaySequence = (select min(DisplaySequence) from services) and masterlistID = (select masterlistID from masterlists where DisplaySequence = (select min(DisplaySequence) from masterlists))) and a.DisplaySequence = (select min(DisplaySequence) from types where masterlistID = (select masterlistID from masterlists where DisplaySequence = (select min(DisplaySequence) from masterlists))))) and a.target = b.Location order by country, region
Would you mind reading what I write?Luis G said:my guess is that you use nested selects because you're too lazy to optimize your queries.
By all means, PLEASE! My boss will kiss you (a she). We spent days on all our queries running lots of traces, looking for table scans, performing special indices, moving tablespaces, etc., and of course the query itself, moving compares, switching first and second parameters, etc., and this is as good as we got it.Luis G said:ohhhh sorry, i just read it fast (too lazy of me ), i kind of see it again, and yeap, it looks ok, however, there must be room for some optimization