[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get
Terje Kristensen (terje@xxxxxxxxx) writes:
> In a SQL like : SELECT table1.f1,table2.f1 FROM table1,table2
> you get a listing like this.
>
> +----+----+
> | f1 | f1 |
> +----+----+
> | 1 | 1 |
> | 1 | 2 |
> | 1 | 3 |
> +----+----+
>
> When using the DBI function fetchrow_hashref() you get only one value since
> the key is not unique.
> Is there a way to get MySQL to return with the syntax "TABLENAME.FIELDNAME",
> and not just "FIELDNAME" ?
> I know that you can use aliases to get a similar effect but it's a hassle to
> write sql's like this :
> SELECT table1.f1 as 'table1.f1',table2.f1 as 'table2.f1' FROM table1,table2
Nope, you do it like "select table.f1 as t1f1,table2.f1 as t2f1 from table1,table2"
I tried to get it to return with tablename.fieldname, but I couldn't - I can't understand why you would want to, anyway. As I recall, it also breaks the SQL-92 standard.
--
Ed Carp, N7EKG - erc@xxxxxxxxx - 214/341-4420 - http://www.pobox.com/~erc
Squished Mosquito, Inc.
Internet Applications Development
Escapade Server-Side Scripting Language Development Team
http://www.squishedmosquito.com
Pensacola - Dallas - Dresden - London
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread84598@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.