MySQL Update and Sort Queries
| From: | Ng Hwee Hwee | Date: | Fri, 20 Feb 2004 03:59:53 +0000 |
| Subject: | MySQL Update and Sort Queries | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33040@lists.php.net to get a copy of this message | ||
hi all,
1) Question on UPDATE
----------------------------
My situation is this: I want to update Table1 with values that can be found in Table2.. in short, I
would like to do the following:
$query = "update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no =
Table2.no";
however, only MySQL 4.0.4 allows multiple updates and mine is 3.23.54... is there a way to achieve
the same effect in one MySQL statement but WITHOUT using this multiple update technique?
2) Question on SORT
-------------------------
I would like to retrive my data from the database in the order which I had inserted it in.. is there
a way to tell MySQL NOT to sort it in a certain way?? apparently, the result set i got seem to be
sorted according to NAME although I did NOT append my query with an "ORDER BY"...
i'm using phpMyAdmin to view my database records and they are in the order which I inserted
them in.. i would like to see this order too when i issue a SELECT on it.. how can I do this?
$query2 = "select * from GUEST where Hotel = 'PPH'";
Thank you so much! I look forward to hearing from you!
Hwee :o)