Update table with value from another table












0















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.










share|improve this question














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
















0















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.










share|improve this question














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














0












0








0








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • "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










1 Answer
1






active

oldest

votes


















0














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






share|improve this answer
























  • 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











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
});


}
});














draft saved

draft discarded


















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









0














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






share|improve this answer
























  • 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
















0














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






share|improve this answer
























  • 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














0












0








0







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






share|improve this answer













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







share|improve this answer












share|improve this answer



share|improve this answer










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



















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL Server 17 - Attemping to backup to remote NAS but Access is denied

Always On Availability groups resolving state after failover - Remote harden of transaction...

Restoring from pg_dump with foreign key constraints