forums › forums › SQLyog › Using SQLyog › Is Update Possible Without Creating New Table
- This topic is empty.
-
AuthorPosts
-
-
October 26, 2011 at 3:22 pm #12484wattoMember
Hi there
I am seeking assistance with an UPDATE i require to perform.
I am 'OK' with SQL but by no means really proficient with it.
I have identified the records that i wish to update through a query but i am unable to perform the update i wish.
Hopefully a screen shot will help (showing how i have identified the records i wish to update)
[img]http://C:UsersKeithDocumentsBusinessClientsASTSQLyogupdate posting.jpg[/img]
Image also attached.
In summary: I have 2 tables (account and packages).
Both tables have common key field of customer_id
Both table have a field named account_owner but i have a number of records in the packages table that are missing the appropriate account_owner detail.
What i am looking for is the appropriate SQL so that i can update the account_owner in the packages table to match the account_owner entry in the accounts table.
I do have UPDATE permissions but i am unable to create new tables in the database.
Help will be appreciated.
Keith
-
October 27, 2011 at 9:29 am #32746Jan.SMember
Hi Keith,
Can you attach the image using the attach button below rather than the insert image button above, in the editor?
Also, are you looking for a query or is there a specific error that you get when you run your query?
Update is possible without CREATE privileges if you have the UPDATE privilege.
Regards,
Janani
-
October 27, 2011 at 4:11 pm #32747wattoMember'watto' wrote:
Hi there
I am seeking assistance with an UPDATE i require to perform.
I am 'OK' with SQL but by no means really proficient with it.
I have identified the records that i wish to update through a query but i am unable to perform the update i wish.
Hopefully a screen shot will help (showing how i have identified the records i wish to update)
[img]http://C:UsersKeithDocumentsBusinessClientsASTSQLyogupdate posting.jpg[/img]
Image also attached.
In summary: I have 2 tables (account and packages).
Both tables have common key field of customer_id
Both table have a field named account_owner but i have a number of records in the packages table that are missing the appropriate account_owner detail.
What i am looking for is the appropriate SQL so that i can update the account_owner in the packages table to match the account_owner entry in the accounts table.
I do have UPDATE permissions but i am unable to create new tables in the database.
Help will be appreciated.
Keith
-
October 27, 2011 at 4:19 pm #32748wattoMember'watto' wrote:
Hi there
I am seeking assistance with an UPDATE i require to perform.
I am 'OK' with SQL but by no means really proficient with it.
I have identified the records that i wish to update through a query but i am unable to perform the update i wish.
Hopefully a screen shot will help (showing how i have identified the records i wish to update)
[img]http://C:UsersKeithDocumentsBusinessClientsASTSQLyogupdate posting.jpg[/img]
Image also attached.
In summary: I have 2 tables (account and packages).
Both tables have common key field of customer_id
Both table have a field named account_owner but i have a number of records in the packages table that are missing the appropriate account_owner detail.
What i am looking for is the appropriate SQL so that i can update the account_owner in the packages table to match the account_owner entry in the accounts table.
I do have UPDATE permissions but i am unable to create new tables in the database.
Help will be appreciated.
Keith
-
October 27, 2011 at 4:21 pm #32749wattoMember
Hi Janani
As you can see i am new to this stuff (adding replies etc), sorry about that.
I have tried to attache a screen shot of how i identified the records i wish to update.
I wish to use a query to update the records.
Regards, Keith
-
October 27, 2011 at 6:30 pm #32750peterlaursenParticipant
I think you finally figured out how to add files here! 🙂
Once you have the result set as in your image just change the dorpdown from 'Read Only' to the name of the table you want to update. Now the DATA GRID is writeable. Whenever you click on 'save* (the diskette icon) you will save. You will alos save whne the GRID-cursor moves to another row of the result set.
Please see image [attachment=1651:writeable.jpg]
Did this help?
-
October 28, 2011 at 3:11 pm #32751wattoMember'peterlaursen' wrote:
I think you finally figured out how to add files here! 🙂
Once you have the result set as in your image just change the dorpdown from 'Read Only' to the name of the table you want to update. Now the DATA GRID is writeable. Whenever you click on 'save* (the diskette icon) you will save. You will alos save whne the GRID-cursor moves to another row of the result set.
Please see image [attachment=1651:writeable.jpg]
Did this help?
Peter, Thanks for your reply
Did it help? Yes and No!
Yes, i can do the update manually.
But No in that this s something that i wish to do regularly and preferably not manually. I was hoping to discover if i could create some SQL to do the update?
I do have permissions to create 'views' if that would help?
Regards, Keith
-
October 28, 2011 at 3:34 pm #32752peterlaursenParticipant
Of course you can write an UPDATE statement as well. Once you have the SELECT statement returning the rows you want it can easily be modified to an UPDATE statement.
MySQL documentation http://dev.mysql.com/doc/refman/5.1/en/update.html
-
-
AuthorPosts
- You must be logged in to reply to this topic.