Sql Help

I need help with a SQL.

I need to change some items that have a Category to a certain department then delete the category i just changed from. For instance item one department is (beer) and its category is (Groc) I want to change every item in the category (groc) to department (kegs). Can someone help with this statement. Thanks in advance

Reply to
Doug Pic-N-Pac
Loading thread data ...

Hi Doug

Run these select statements first select * from department (confirm and jot down the id of the department you want to set the item(s) to) select * from category (confirm and jot down the id of the category you want to "delete" and assign to the above department)

lets say your keg department id is 1 and the groc category id is 2

first run this test select query to confirm your groc category items select * from item where categoryid = 2

If all the items that show in the results should be changed to the keg dept then you're ready for your update query; BACKUP FIRST update item set departmentid = 1, categoryid = 0 where categoryid = 2

-- this will assign all "groc" category items to the keg dept and no category

You can manually delete the groc category in SO manager - depts and categories Hope this helps...

"Doug Pic-N-Pac" wrote:

Reply to
convoluted

Thanks convoluted i will try that today.

"c> Hi Doug

Reply to
Doug Pic-N-Pac

Hi Doug,

How about , open manager program and navigate to department and category from database menu, then open the property of your category (groc) and change the department from here, the system will ask you if you wish to transfer all items to the new configuration.

Reply to
Mahmoud Amin

Sorry,

This is for ALL ITEMS related to that category,

Reply to
Mahmoud Amin

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.