How to add to string a new string [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 have a database with products.
I need to add to name of products some string.
Example:
product name "abc1", "abc2", "abc3"
new products name: "Super abc1", "Super abc2", "Super abc3"

Use MySQL's concat().
If you want to update :
update tablename set column=concat('Super ', column);
You can even add a where clause .

update player
set productName= concat("super ",productName)

You need to use CONCAT function
SELECT CONCAT('Super ',columnWithABc) from tab

Related

How can i get this SQL on yii2? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am working with Yii2 and I need to use the Query Builder to convert the following raw SQL query where I am using a subquery in the inner join.
SELECT *
FROM class
INNER JOIN
(SELECT name, MAX(score) AS Maxscore
FROM class
GROUP BY name) topscore
ON class.name = topscore.name
AND class.score = topscore.maxscore;
You should show a bit of effort on your behalf as it is how it works here on SO, but as you are a new bee so i am adding an answer.
It is pretty straight forward see the Query builder guide, and you need to use the subquery in the following way
$subQuery = new \yii\db\Query();
$subQuery->select([new \yii\db\Expression('[[name]], MAX([[score]]) as Maxscore')])
->from('class')
->groupBy('[[name]]');
$query = new \yii\db\Query();
$query->select('*')
->from('class')
->innerJoin(['topscore'=>$subQuery])
->where(['=','class.[[name]]',new \yii\db\Expression('topscore.[[name]]')])
->andWhere(['=','class.[[score]]',new \yii\db\Expression('topscore.[[maxscore]]')])
->all();
Note: I didn't tested it thou but it should work correctly.

Flash AS3 suddenly unable to delete values from objects [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
This is fairly interesting. Flash CS6 has suddenly lost the ability to iterate through objects and delete their values (which did work before)
Delete all values from object keys
for each(var key:String in ScoreKeep.scoreCard)
ScoreKeep.scoreCard[key] = 0;
The object (ScoreKeep.as)
static public var scoreCard:Object = {
"Fish":6, "Golfball":2, "Gloves":8, "Boot":4,
};
You can trace the object key. The value will still be there.
You are using it wrongly, it is not supposed to be for each but for. for each would take the value, not the key.
You also have a "," after the last prop in your object, I assume that's a typo (and should result in a compile-time error).

transfer a simple text to json [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to convert a simple text to json programmatically using linux script bash or any other scripting language !
Raw text was like this :
Question 1 ?
Answer1,answer2,answer3{C},answer4
Question 2 ?
{C}Answer1,answer2,answer3,answer4
Question 3 ?
Answer1,answer2{C},answer3,answer4
...
Actually I succeeded to convert it , but now I need to update correct value to the right answer number tagged by {C} for every question !
{
"introduction":"My Quiz",
"questions":[
{"question":"Question 1?",
"answers":["answer1","answer2","answer3{C}","answer4"],
"correct":2},
{"question":"Question 2?",
"answers":["{C}answer1","answer2","answer3","answer4"],
"correct":2}
]
}
Any ideas ?
my ($correctans) = grep {s/.*(\d).*/$1/ if m/C/} (my #answers = qw({C}Answer1 answer2 answer3{C} answer4));

Inner join with 3 tables MySql [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I have 3 tables (ativo, modelo, tipo) and I need get some columns of the tables (tipo and modelo).
Structure:
Ativo: id_ativo, name_ativo, fk_tipo_atv, fk_modelo_atv
Tipo: id_tipo, name_tipo
Modelo: id_modelo, name_modelo, fk_tipo_modelo
I need list "name - name_tipo - name_modelo"
Anyone can help me?
You haven't given us much to go on regarding what results you want, how the tables are linked and what you've tried but assuming that Ativo.fk_tipo_atv is a link to Tipo.id_tipo and Ativo.fk_modelo_atv is a link to Modelo.id_modelo:
SELECT a.name_ativo,t.name_tipo,m.name_modelo
FROM Ativo a
INNER JOIN Tipo t ON (a.fk_tipo_atv = t.id_tipo)
INNER JOIN Modelo m ON (a.fk_modelo_atv = m.id_modelo)

Listing specific data in Query [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'm learning databases and I have a question: How can I list all the students that study in a specific school using joins?
My table is as follows:
X:schoolName(PK), SchoolAddress, SchoolTelephoneNumber
Y:schoolName(FK),StudentName,StudentNumber
How can i find out all the students name that study in 'London School' including there StudentNumber, SchoolAddress?
Try this:
SELECT
Students.StudentName,
Students.StudentNumber,
Schools.SchoolAddress
FROM
XSchools
INNER JOIN YStudents
ON Schools.schoolName = Students.schoolName
WHERE Schools.schoolName = 'London School'
SELECT
StudentName,
StudentNumber,
SchoolAddress
FROM
X
JOIN Y
WHERE Y.schoolName = 'London School'