MySQL update statement that partially changes the value of a column [closed] - mysql

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I need to update the value of a column in a db table substituting part of a path.
My current path is:
software-features/adadadad.html
It should become:
software/adadadad.html
I need an sql update statement (valid for MySQL 5.5) that changes just a part of the value of a column

Is this what you want?
update t
set path = replace(path, 'software-features', 'software')
where path like 'software-features%';

The "replace" function would seem to do what you want, but it's unclear from your question how specific or generalized the solution you're looking for is:
UPDATE MyTable
SET path = REPLACE(path, "software-features/", "software/")

Related

Multiple row insert in a mysql table [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Hi I need to update multiple rows in a table so I wrote below query, but it only updates the first row and not the others. Please help.
Query:
String sql = "REPLACE INTO subscriber_metadata (msisdn, have_had_speech_pkg, have_had_sms_pkg, created, changed) values ";
Well REPLACE INTO does the following DELETE + INSERT, what you're looking for is UPDATE, doc over here
REPLACE INTO is nothing more than a mechanical DELETE and INSERT. It can incite mysqld to address deadlocks (See my answer to How I prevent deadlock occurrence in my application?)

MySql Returns Wrong Ordering Result [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have this table:
Well, When I execute this query:
SELECT * FROM users order by rp_bought desc limit 5
I get no errors but, The username, Raed is in the last place as Raed Has the Most Rp_Bought (1300)
Im Wondering Why is this Problem Occurring.
This would occur if rp_bought were stored as a string rather than as a number. In MySQL you can easily fix this by adding 0:
order by rp_bought + 0 desc
The + 0 is an easy way to convert from a string to a number (with no additional errors occurring).

Can I simulate that my MySql field is an array [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I simulate that my MySQL field is an array, and later with some query to search element in that array ?
In only MySql:
To get the field.
select FIELDNAME from TABLE
To search from that result set:
select FIELDNAME from TABLE where FIELDNAME like '%myvalue%'
The %'s are wild cards. This would return any value with myvalue in it.
Such as:
(amyvalue, bmyvalueb, I<3myvaluecompletely)
If you want this done in some language you need to provide a more verbose and detailed question.

Mysql query search one column and replace another [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I've got a large database table and wanting to select rows in the column 'cat_id' containing the value "79", then replace all the values in a column called "system" with the value "6" for the selected rows.
This query will do that:
UPDATE `table` SET `system` = '6' WHERE `cat_id` = '79'
I could be misunderstanding you, but i think you are looking for a simple update:
UPDATE yourTable
SET system = 6
WHERE cat_id = 79;

MySQL insert into two fields, if combination of content in this fields is unique [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i have a mysql table with fields:
appName appVersion
i want to insert content into this fields if combination of appName and appVersion not exist in it.
In MySQL you have an option:
Create unique index by 2 columns appName, appVersion
Use INSERT IGNORE - this will skip INSERT if the corresponding record already exists in table