Why does this sql query take so long?

I’m still not quite sure if you’re having a go at my claim that I have been able to do complex queries before without needing SDMB help.

I only mean they are complex in the context of a person (me) who came to learn SQL (from virtually no sql knowledge) by happening to work at a place that has a (badly designed*) sql database. When compared alongside a DBA’s queries (I’m not a DBA) most of mine are probably ‘ugly’ and inefficient. But for my purposes they do the job.

*Badly designed by someone else, not me. It was a database built for an insignificant purpose and has grown over the years to be used for more and more important purposes.

Many more of my sql queries have never seen the SDMB.

Lobsang, I am glad you have this resource to turn to when you run into roadblocks. however, my personality, as well as many others on the SD, tends toward pointing out inconsistencies and correcting them.

Yes, I am “having a go at your claim” that you are pretty good at complex one-off queries. You may be able to build something that does the job, but if what you build is ugly and inefficient (your words), then by definition you cannot be “pretty good” at it, especially in a thread where you’re asking people who are much better at it than you. It’s like me telling a professional carpenter that I maanged to hack together a new stud wall that is not up to the building code, and then insisting that I’m pretty good at carpentry.

No it isn’t. It’s just like saying “I’m pretty good for someone who isn’t a carpenter. I’ve built a tool-shed. It may look ugly but it holds my tools. And it’s better than many other non-carpenters”

And I think you’re being unreasonably bad tempered and not very nice. I’m a lay-person asking for help, and you’re criticising me for implying that I can write better queries than a bus-driver or even an IT manager.
In short: You’re being a snob.

I don’t think anyone is going to look at a very ugly tool shed and claim they are pretty good for a non-carpenter unless they hold themselves to VERY low standards. They’re going to say “I am not the greatest carpenter, but I managed to build somethign that holds all my tools, so I am happy.”

But go ahead, give yourself a gold star for being pretty good at complex queries. Much ignorance stems for people beleiving that they know more than they do instead of questioning what they do know.

Why are you persisting? If it makes you feel warm inside to have a go at me like this then I guess I’ll ignore you in future. Or you might even be the first person ever to make it onto my ignore list. It’s such an insignificant thing to be up-in-arms about and this is GQ. If you have a problem with my confidence in my own SQL abilities as compared to that of other lay-people then take it to the pit. Youre just being strange and unreasonable.

I Tool shed that is not pretty but is structurally sound and does the job for which it was built is a sign of good carpentry if it has been built by someone who has never had carpentry training and is a self-confessed amateur.

[Modding]

Lobsang, crazyjoe, this argument over what constitutes a “good” SQL… whatever is off-topic and not appropriate to GQ. I suggest you both drop the subject.

[/Modding]