Update table with value from another table
i have two Tables:
AudiTable
Id Audi_cod status marke1
1 011 mid Null
2 022 mid Null
3 033 mid Null
RenoTable
Id Model marke2
1 N1 R1
2 N2 R2
3 N3 R3
i have this Query:
UPDATE AudiTable
INNER JOIN RenoTable ON AudiTable.Id = RenoTable.Id
SET status = 'good', AudiTable.marke1=RenoTable.marke2
WHERE RenoTable.Model = N3 and AudiTable.Audi_cod=011
my question is how to take a value from one row and put it in a different row. thanks in advance.
mariadb
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
i have two Tables:
AudiTable
Id Audi_cod status marke1
1 011 mid Null
2 022 mid Null
3 033 mid Null
RenoTable
Id Model marke2
1 N1 R1
2 N2 R2
3 N3 R3
i have this Query:
UPDATE AudiTable
INNER JOIN RenoTable ON AudiTable.Id = RenoTable.Id
SET status = 'good', AudiTable.marke1=RenoTable.marke2
WHERE RenoTable.Model = N3 and AudiTable.Audi_cod=011
my question is how to take a value from one row and put it in a different row. thanks in advance.
mariadb
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
"different row" -- how will that row be identified?
– Rick James
Sep 20 '17 at 3:18
add a comment |
i have two Tables:
AudiTable
Id Audi_cod status marke1
1 011 mid Null
2 022 mid Null
3 033 mid Null
RenoTable
Id Model marke2
1 N1 R1
2 N2 R2
3 N3 R3
i have this Query:
UPDATE AudiTable
INNER JOIN RenoTable ON AudiTable.Id = RenoTable.Id
SET status = 'good', AudiTable.marke1=RenoTable.marke2
WHERE RenoTable.Model = N3 and AudiTable.Audi_cod=011
my question is how to take a value from one row and put it in a different row. thanks in advance.
mariadb
i have two Tables:
AudiTable
Id Audi_cod status marke1
1 011 mid Null
2 022 mid Null
3 033 mid Null
RenoTable
Id Model marke2
1 N1 R1
2 N2 R2
3 N3 R3
i have this Query:
UPDATE AudiTable
INNER JOIN RenoTable ON AudiTable.Id = RenoTable.Id
SET status = 'good', AudiTable.marke1=RenoTable.marke2
WHERE RenoTable.Model = N3 and AudiTable.Audi_cod=011
my question is how to take a value from one row and put it in a different row. thanks in advance.
mariadb
mariadb
asked Sep 18 '17 at 15:14
terytery
45
45
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
"different row" -- how will that row be identified?
– Rick James
Sep 20 '17 at 3:18
add a comment |
"different row" -- how will that row be identified?
– Rick James
Sep 20 '17 at 3:18
"different row" -- how will that row be identified?
– Rick James
Sep 20 '17 at 3:18
"different row" -- how will that row be identified?
– Rick James
Sep 20 '17 at 3:18
add a comment |
1 Answer
1
active
oldest
votes
Using Oracle
MERGE INTO AudiTable
USING
(
SELECT
id,
marke2,
model
FROM RenoTable
) TA ON (TA.ID = AudiTable.id)
WHEN MATCHED THEN UPDATE
SET AudiTable.STATUS = 'good',AudiTable.MARKE1=TA.MARKE2
where TA.MODEL ='N3' and AudiTable.audi_cod=033;
Source:
How to update a table from a another table
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f186222%2fupdate-table-with-value-from-another-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Using Oracle
MERGE INTO AudiTable
USING
(
SELECT
id,
marke2,
model
FROM RenoTable
) TA ON (TA.ID = AudiTable.id)
WHEN MATCHED THEN UPDATE
SET AudiTable.STATUS = 'good',AudiTable.MARKE1=TA.MARKE2
where TA.MODEL ='N3' and AudiTable.audi_cod=033;
Source:
How to update a table from a another table
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
add a comment |
Using Oracle
MERGE INTO AudiTable
USING
(
SELECT
id,
marke2,
model
FROM RenoTable
) TA ON (TA.ID = AudiTable.id)
WHEN MATCHED THEN UPDATE
SET AudiTable.STATUS = 'good',AudiTable.MARKE1=TA.MARKE2
where TA.MODEL ='N3' and AudiTable.audi_cod=033;
Source:
How to update a table from a another table
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
add a comment |
Using Oracle
MERGE INTO AudiTable
USING
(
SELECT
id,
marke2,
model
FROM RenoTable
) TA ON (TA.ID = AudiTable.id)
WHEN MATCHED THEN UPDATE
SET AudiTable.STATUS = 'good',AudiTable.MARKE1=TA.MARKE2
where TA.MODEL ='N3' and AudiTable.audi_cod=033;
Source:
How to update a table from a another table
Using Oracle
MERGE INTO AudiTable
USING
(
SELECT
id,
marke2,
model
FROM RenoTable
) TA ON (TA.ID = AudiTable.id)
WHEN MATCHED THEN UPDATE
SET AudiTable.STATUS = 'good',AudiTable.MARKE1=TA.MARKE2
where TA.MODEL ='N3' and AudiTable.audi_cod=033;
Source:
How to update a table from a another table
answered Sep 18 '17 at 17:26
user3145731user3145731
1
1
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
add a comment |
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
Sorry didn't notice it was mariadb.
– user3145731
Sep 18 '17 at 21:02
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
i want to update just one value from AudiTable using one value from RenoTable. how can i do that using MariaDB
– tery
Sep 19 '17 at 7:46
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f186222%2fupdate-table-with-value-from-another-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"different row" -- how will that row be identified?
– Rick James
Sep 20 '17 at 3:18