Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Josh Williams
On Mon, 2008-01-07 at 17:03 -0500, Emi Lu wrote: > select ?max?(col1, col2, col3) as result; > will return > > result > --- > 5 > 8 > 12 > > (3 rows) 8.1 (I believe?) introduced GREATEST(), which does precisely what you're looking for. But if 8.0 is a must, you'll probably have to create yo

Re: [SQL] INSERT INTO

2007-03-16 Thread Josh Williams
L statement: > INSERT INTO TABLE2 (TE_INDI) VALUES ('SANT'ANGELO LODIGIANO'); INSERT INTO TABLE2 (TE_INDI) VALUES SELECT TE_INDI FROM TABLE1 WHERE (...) No quoting or server->client->server worries to deal with at all... Best of luck, - Josh Williams ---

Re: [SQL] How to query by column names

2007-01-22 Thread Josh Williams
t;SELECT * FROM $tablename" | while etc Worst case, you'll end up with a messy $leftside and $rightside variable set. To answer the original question, the field must be hard coded either as a list or that perhaps over-used(?) asterisk. If you really need to pull and use t