Reply to Re: Wild card aliases...

Your name:

Reply:


Posted by Erwin Moller on 12/16/89 11:58

Jeff Gardner wrote:

> Greetings:
>
> Is there a way to do <snip>SELECT table.* AS alias.*</snip>, or do I
> have to write additional code to automate the process?

Which database are you using and what do you want to accomplish?

Two concepts that may be interest:
Alias:

You can use an alias like this:
SELECT U.username, U.userpass, I.total FROM tblUsers AS U, tblItems AS I
WHERE (U.userid=I.userid);

So you name the tables, and tell the database which column to use.
This can come in handy in many situations, eg if you use the same table 2
times in your query.

Derived table:
consider a complex query:
(SELECT U.userid, MAX(U.orderedItems) AS maxOrd FROM tbluser AS U WHERE
(blabla) AND (blabla))

You can use the RESULTS of that query as a real table by giving it a name.
SO you get constructs like:
SELECT U.userid, I.orderedItems, DRV1.maxInJanuary
FROM
tbluser AS U,
tblItems AS I,
(bigqueryhere) AS DRV1
WHERE (
(U.userid=I.userid) AND
(DRV1.maxInJanuary < 10)
)

In that way you can use the results from a query as a real table.

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация