[thelist] Nested SQL question

Matthew Walker matthew at electricsheep.co.nz
Sun Sep 10 17:25:19 CDT 2000

> you gotta know i'm all over it, right?    ;o)

Yeah Rudy, I was thinking of you when I sent this (funny I've never used
*that phrase* for business purposes before).

> so let me make some comments on your problem, matthew, while you let us
> know how soon you need this, and i'll backstop ya in case nobody
> else takes
> it

There's no timeframe at all -- it was simply a Sunday-afternoon-project I
was pursuing as an idea of my own.

> your problem, matthew, was stated almost completely in database terms, and
> i know it's not polite to inquire into areas that are outsite the
> bounds of
> the question (i get shit all the time at work for doing this)...

Man, I don't care! Often other people highlight things you don't see
yourself. Actually, I think that's part of the process. Often I get people
asking for specific things, and I have to shake "what they really want" out
of them before I can do the job.

> maybe give them a choice -- list all recipes they can make, or list all
> recipes in order by number of missing ingredients, starting with 0, that
> they, um, don't have...
> i would have to question whether the *number* of missing ingredients
> matters -- other than, yes, being a most excellent sort control
> if you were
> going to list recipes including ones the user cannot make

Yeah, the idea is maybe list those ones with no missing ingredients. But
perhaps list those with just one or two or three missing ingredients too as
an optional extra. You could do all sorts of things like recommend the best
ingredient to expand your available recipes. I think I could probably manage
that query. Or maybe not.

> how soon do you have to have this working, matthew?

No hurry at all. SQL is my Achilles heel (well one of many, but it's right
up there). I can only just grasp the most basic nested queries. So I figured
this was probably easy as pie for competent folk. But then ignorance does
that -- people come to me expecting me to build shopping systems that
automatically "know" whether a product is or isn't in stock..... I have been
known to take a problem like this and convert it into several queries with
some server-side programming tying it all together. Biggest problem there is
that generally you need to finish up with your own sort routine as well
which is just nuts. I'm trying not to do that kinda thing anymore!

While we're at it, could anybody recommend their favourite SQL book?

Hey I'm quite happy to be invoiced for this one, even though the NZ dollar
has recently made great strides towards achieving a value commensurate with
toilet paper. And not the priceless "I'm lost in the woods with half a roll"
kind -- the "I live across the road from the supermarket and have a budget
family 12 pack" kind.

More information about the thelist mailing list