Update query question
Posted: Mon Feb 28, 2005 6:21 pm
Hi all,
Just wondering with an UPDATE query, what is the real function of the SORT BY parameter.
It's just that I have a number of rows in a table that are keyed to a row in another table and an array of the new values to be updated.
The SORT BY function would be really handy if I could send the values to a single query and let it update in the order they need to be. Otherwise I will need to run individual updates for each row, and I'm usure of how to keep them in order.
As an example, I have products in tbl_products, the available sizes in tbl_sizes, and the prices in tbl_prices. The entry in products defines the product, and the sizes defines the different sizes for all items sorted per category from smallest to largest, and the tbl_prices entry links a product to a size and defines a price.
I then have a form which pulls out the price values for all sizes of a particular product, and when I push submit, I want to change the prices for the appropriate rows in the prices table.
If I could pass all the values to a single update with a SORT BY setting, then maybe I could update them in the correct order, otherwise I'm not sure how I can ensure that the correct value goes in the correct place short of querying the list of prices again and then looping though the ID's as targets for update.
Any pointers on best method would be great. Cheers.
Just wondering with an UPDATE query, what is the real function of the SORT BY parameter.
It's just that I have a number of rows in a table that are keyed to a row in another table and an array of the new values to be updated.
The SORT BY function would be really handy if I could send the values to a single query and let it update in the order they need to be. Otherwise I will need to run individual updates for each row, and I'm usure of how to keep them in order.
As an example, I have products in tbl_products, the available sizes in tbl_sizes, and the prices in tbl_prices. The entry in products defines the product, and the sizes defines the different sizes for all items sorted per category from smallest to largest, and the tbl_prices entry links a product to a size and defines a price.
I then have a form which pulls out the price values for all sizes of a particular product, and when I push submit, I want to change the prices for the appropriate rows in the prices table.
If I could pass all the values to a single update with a SORT BY setting, then maybe I could update them in the correct order, otherwise I'm not sure how I can ensure that the correct value goes in the correct place short of querying the list of prices again and then looping though the ID's as targets for update.
Any pointers on best method would be great. Cheers.