Re: column alias on mass
sks wrote:
> but I want to be able to say
>
> select p.* from products p, so that it returns the columns as such
>
> p.id | p.name | p.price
>
> Obviously I can do this manually as such
>
> select p.id, p.name, p.price from products p ....
Actually, that would return
id | name | price
The column labels don't implicitly include the table alias dot notation.
You'd have to do a query like this:
select p.id as `p.id`, p.name as `p.name`, p.price as `p.price` from
products p ....
It's good to get in the habit of using the backquotes, because then you
can use special characters or even whitespace in your column labels.
There is no syntax to declare the column labels automatically. You have
to specify all of them individually.
Regards,
Bill K.
|