Mysql query search one column and replace another [closed] - mysql

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;

Related

MySQL update statement that partially changes the value of a column [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 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/")

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.

How to fetch unique(PKID, Column1,column2) from mySQL? [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
Could anybody let me know that how can i fetch unique(PKID, Column1,column2) values from my_table in mySql?
You can either use Ozzyberto's way, which should work, or you could use GROUP BY:
SELECT PKID,Column1,Column2
FROM my_table
GROUP BY PKID,Column1,Column2
sqlfiddle demo
You must be looking for the DISTINCT keyword:
http://www.w3schools.com/sql/sql_distinct.asp
You would need the following query:
SELECT DISTINCT PKID, Column1,column2 FROM my_table

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

Multiply a column in every row [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 table that contains a column price with 3600 entries. I need to increase the price column by 9% or multiply the contents of the column price by 1.09 and place the updated price back in the price column. What is the best way to approach this?
Should be pretty straightforward:
Update MyTable Set Price = Price*1.09