On Thu, 12 Feb 2004, Martijn Tonies wrote:

> > SELECT
> >  person.*,place.* as home_*
> > FROM
> >  person,place
> > WHERE
> >  person.home_id = place.id
> > AND
> >  name = 'Joe'
>
> What if more of your tables have a column "name"?

then:
  person.*,place.* as home_*,thing.* as thing_*  (etc...)

> > The problem is that I don't want to have to update my queries everytime I
> > add a new column, so I use table_name.* a lot.  But then if I ever add a
>
> Really? That's stupid :-) ... Ask only for the columns you need:
> the rest is increased network traffic.

Well, I am using all that data in my application, but I have divided up the
queries from the presentation so that I can get the data once, and display
it in many ways (or the other way around -- get the data in different ways
and run it through the same display engine).

What I would like to do is add a new column and then be able to access that
data in the display layer, without updating the query.  Isn't that what the
* is in sql for?

I have done this in the application layer, by building a big data structure
like:

 person->id
 person->name
 person->home->id
 person->home->name
 person->home->zip_code

but that requires a lot of seperate queries, and so has a lot of overhead
when you want the info for 100's of objects at a time.

- Isaac


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to