January 7, 2016 at 12:07 pm
So here I would like to insert a value X in a column that `parent_id` conditionally called in the column which is called` sort_order` the value 1 is present.
Is it possible to do this?:-)
January 7, 2016 at 12:12 pm
guy 1966 (1/7/2016)
So here I would like to insert a value X in a column that `parent_id` conditionally called in the column which is called` sort_order` the value 1 is present.Is it possible to do this?:-)
Hi
welcome to SSC forums......probably best way for us to give you a definitive answer, is for you to read
http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/
and post back with some relevant data that will assist us and you.
good luck
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
January 7, 2016 at 12:16 pm
guy 1966 (1/7/2016)
So here I would like to insert a value X in a column that `parent_id` conditionally called in the column which is called` sort_order` the value 1 is present.Is it possible to do this?:-)
I believe that you're looking for an UPDATE statement
It might be as simple as this:
UPDATE YourTable SET
parent_id = 0 --Value X
WHERE sort_order = 1;
January 7, 2016 at 12:52 pm
I try this :
UPDATE `categories` SET `parent_id`= 0 [2055] WHERE `sort_order`= 1
the 2055 is the value to try to applie, but I have error syntax... I use the sql editer on my server to white the code.
thank!
January 7, 2016 at 1:00 pm
OK , I resolve my error syntax:
UPDATE `categories` SET `parent_id`= 2055 WHERE `sort_order`= 1
Thank you so must 😛
January 7, 2016 at 1:02 pm
guy 1966 (1/7/2016)
I try this :UPDATE `categories` SET `parent_id`= 0 [2055] WHERE `sort_order`= 1
the 2055 is the value to try to applie, but I have error syntax... I use the sql editer on my server to white the code.
thank!
Of course you're getting an error. You didn't replace the zero, you just replaced the comment.
This seems like some RDBMS different from SQL Server. I'm not sure if the quotes and square brackets are needed or might be causing a syntax error as well.
UPDATE is basic in SQL. You should study how to correctly generate statements with the basic DML (INSERT, UPDATE, DELETE) before implementing any code. It's dangerous and you could get in lots of trouble.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply