Using columns from different tables to create one table
I am not sure how I can get this code to have three columns for each category (Portrait,Landscape, and Abstract). As of now, it only has one column and all three of these values computed values:
SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
Query output
Any advice is greatly appreciated
sql
add a comment |
I am not sure how I can get this code to have three columns for each category (Portrait,Landscape, and Abstract). As of now, it only has one column and all three of these values computed values:
SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
Query output
Any advice is greatly appreciated
sql
add a comment |
I am not sure how I can get this code to have three columns for each category (Portrait,Landscape, and Abstract). As of now, it only has one column and all three of these values computed values:
SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
Query output
Any advice is greatly appreciated
sql
I am not sure how I can get this code to have three columns for each category (Portrait,Landscape, and Abstract). As of now, it only has one column and all three of these values computed values:
SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
Query output
Any advice is greatly appreciated
sql
sql
edited Nov 26 '18 at 2:39
Johngianni
asked Nov 26 '18 at 1:45
JohngianniJohngianni
207
207
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
This can be done by using pivot as follows
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
)x
pivot (sum(total_sales) for photo_type in(Portrait,Landscape))y
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
add a comment |
Thank you George, this solved my problem. Here is the final code I have after revising yours:
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT MAX('Abstract'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
)x
pivot (sum(Total_Sales) for photo_type in(Landscape,Abstract,Portrait))y
add a comment |
If you have a photo type
field in your Photos table it would be easier:
SELECT SUM(price), photo_type
FROM Photos
JOIN Models
ON Models.PhotoID = Photos.PhotoID
JOIN Landscape
ON Landscape.PhotoID = Photos.PhotoID
JOIN Abstract
ON Abstract.PhotoID = Photos.PhotoID
GROUP BY photo_type
If not, you could probably do something like:
SELECT SUM(price), type FROM (
SELECT price, 'Models' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models
)
UNION
SELECT price, 'Landscape' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape
)
UNION
SELECT price, 'Abstract' as type from Abstract
) as photos
GROUP BY type
I haven't tested these queries, but they should be at least close to a working solution.
add a comment |
I think I would simply use subqueries:
SELECT (SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Models)
) as TotalSales_Portrait,
(SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Landscape)
) as TotalSales_Landscape,
(SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Abstract)
) as TotalSales_Abstract;
Alternatively, if the secondary tables have no duplicates:
SELECT SUM(CASE WHEN m.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN l.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN a.PhotoId IS NOT NULL THEN price ELSE 0 END)
FROM Photos p LEFT JOIN
Models m
ON m.PhotoID = p.PhotoID LEFT JOIN
Landscape l
ON l.PhotoID = p.PhotoID LEFT JOIN
Abstract a
ON a.PhotoID = p.PhotoID
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f53473788%2fusing-columns-from-different-tables-to-create-one-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
This can be done by using pivot as follows
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
)x
pivot (sum(total_sales) for photo_type in(Portrait,Landscape))y
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
add a comment |
This can be done by using pivot as follows
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
)x
pivot (sum(total_sales) for photo_type in(Portrait,Landscape))y
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
add a comment |
This can be done by using pivot as follows
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
)x
pivot (sum(total_sales) for photo_type in(Portrait,Landscape))y
This can be done by using pivot as follows
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
)x
pivot (sum(total_sales) for photo_type in(Portrait,Landscape))y
answered Nov 26 '18 at 2:23
George JosephGeorge Joseph
1,590510
1,590510
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
add a comment |
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
This seems much more complicated than necessary.
– Gordon Linoff
Nov 26 '18 at 2:57
add a comment |
Thank you George, this solved my problem. Here is the final code I have after revising yours:
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT MAX('Abstract'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
)x
pivot (sum(Total_Sales) for photo_type in(Landscape,Abstract,Portrait))y
add a comment |
Thank you George, this solved my problem. Here is the final code I have after revising yours:
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT MAX('Abstract'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
)x
pivot (sum(Total_Sales) for photo_type in(Landscape,Abstract,Portrait))y
add a comment |
Thank you George, this solved my problem. Here is the final code I have after revising yours:
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT MAX('Abstract'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
)x
pivot (sum(Total_Sales) for photo_type in(Landscape,Abstract,Portrait))y
Thank you George, this solved my problem. Here is the final code I have after revising yours:
select *
from (
SELECT MAX('Portrait') as photo_type,SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models)
UNION
SELECT MAX('Landscape'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape)
UNION
SELECT MAX('Abstract'),SUM(Price) AS Total_Sales
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Abstract)
)x
pivot (sum(Total_Sales) for photo_type in(Landscape,Abstract,Portrait))y
answered Nov 26 '18 at 2:40
JohngianniJohngianni
207
207
add a comment |
add a comment |
If you have a photo type
field in your Photos table it would be easier:
SELECT SUM(price), photo_type
FROM Photos
JOIN Models
ON Models.PhotoID = Photos.PhotoID
JOIN Landscape
ON Landscape.PhotoID = Photos.PhotoID
JOIN Abstract
ON Abstract.PhotoID = Photos.PhotoID
GROUP BY photo_type
If not, you could probably do something like:
SELECT SUM(price), type FROM (
SELECT price, 'Models' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models
)
UNION
SELECT price, 'Landscape' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape
)
UNION
SELECT price, 'Abstract' as type from Abstract
) as photos
GROUP BY type
I haven't tested these queries, but they should be at least close to a working solution.
add a comment |
If you have a photo type
field in your Photos table it would be easier:
SELECT SUM(price), photo_type
FROM Photos
JOIN Models
ON Models.PhotoID = Photos.PhotoID
JOIN Landscape
ON Landscape.PhotoID = Photos.PhotoID
JOIN Abstract
ON Abstract.PhotoID = Photos.PhotoID
GROUP BY photo_type
If not, you could probably do something like:
SELECT SUM(price), type FROM (
SELECT price, 'Models' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models
)
UNION
SELECT price, 'Landscape' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape
)
UNION
SELECT price, 'Abstract' as type from Abstract
) as photos
GROUP BY type
I haven't tested these queries, but they should be at least close to a working solution.
add a comment |
If you have a photo type
field in your Photos table it would be easier:
SELECT SUM(price), photo_type
FROM Photos
JOIN Models
ON Models.PhotoID = Photos.PhotoID
JOIN Landscape
ON Landscape.PhotoID = Photos.PhotoID
JOIN Abstract
ON Abstract.PhotoID = Photos.PhotoID
GROUP BY photo_type
If not, you could probably do something like:
SELECT SUM(price), type FROM (
SELECT price, 'Models' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models
)
UNION
SELECT price, 'Landscape' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape
)
UNION
SELECT price, 'Abstract' as type from Abstract
) as photos
GROUP BY type
I haven't tested these queries, but they should be at least close to a working solution.
If you have a photo type
field in your Photos table it would be easier:
SELECT SUM(price), photo_type
FROM Photos
JOIN Models
ON Models.PhotoID = Photos.PhotoID
JOIN Landscape
ON Landscape.PhotoID = Photos.PhotoID
JOIN Abstract
ON Abstract.PhotoID = Photos.PhotoID
GROUP BY photo_type
If not, you could probably do something like:
SELECT SUM(price), type FROM (
SELECT price, 'Models' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Models
)
UNION
SELECT price, 'Landscape' as type from Photos
WHERE TransID IS NOT NULL AND PhotoID IN (
SELECT PhotoID
FROM Landscape
)
UNION
SELECT price, 'Abstract' as type from Abstract
) as photos
GROUP BY type
I haven't tested these queries, but they should be at least close to a working solution.
answered Nov 26 '18 at 2:14
arodarod
5,00151725
5,00151725
add a comment |
add a comment |
I think I would simply use subqueries:
SELECT (SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Models)
) as TotalSales_Portrait,
(SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Landscape)
) as TotalSales_Landscape,
(SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Abstract)
) as TotalSales_Abstract;
Alternatively, if the secondary tables have no duplicates:
SELECT SUM(CASE WHEN m.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN l.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN a.PhotoId IS NOT NULL THEN price ELSE 0 END)
FROM Photos p LEFT JOIN
Models m
ON m.PhotoID = p.PhotoID LEFT JOIN
Landscape l
ON l.PhotoID = p.PhotoID LEFT JOIN
Abstract a
ON a.PhotoID = p.PhotoID
add a comment |
I think I would simply use subqueries:
SELECT (SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Models)
) as TotalSales_Portrait,
(SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Landscape)
) as TotalSales_Landscape,
(SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Abstract)
) as TotalSales_Abstract;
Alternatively, if the secondary tables have no duplicates:
SELECT SUM(CASE WHEN m.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN l.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN a.PhotoId IS NOT NULL THEN price ELSE 0 END)
FROM Photos p LEFT JOIN
Models m
ON m.PhotoID = p.PhotoID LEFT JOIN
Landscape l
ON l.PhotoID = p.PhotoID LEFT JOIN
Abstract a
ON a.PhotoID = p.PhotoID
add a comment |
I think I would simply use subqueries:
SELECT (SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Models)
) as TotalSales_Portrait,
(SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Landscape)
) as TotalSales_Landscape,
(SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Abstract)
) as TotalSales_Abstract;
Alternatively, if the secondary tables have no duplicates:
SELECT SUM(CASE WHEN m.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN l.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN a.PhotoId IS NOT NULL THEN price ELSE 0 END)
FROM Photos p LEFT JOIN
Models m
ON m.PhotoID = p.PhotoID LEFT JOIN
Landscape l
ON l.PhotoID = p.PhotoID LEFT JOIN
Abstract a
ON a.PhotoID = p.PhotoID
I think I would simply use subqueries:
SELECT (SELECT SUM(Price) AS TotalSales_Portrait
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Models)
) as TotalSales_Portrait,
(SELECT SUM(Price) AS TotalSales_Landscape
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Landscape)
) as TotalSales_Landscape,
(SELECT SUM(Price) AS TotalSales_Abstract
FROM Photo
WHERE TransID IS NOT NULL AND PhotoID IN (SELECT PhotoID FROM Abstract)
) as TotalSales_Abstract;
Alternatively, if the secondary tables have no duplicates:
SELECT SUM(CASE WHEN m.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN l.PhotoId IS NOT NULL THEN price ELSE 0 END),
SUM(CASE WHEN a.PhotoId IS NOT NULL THEN price ELSE 0 END)
FROM Photos p LEFT JOIN
Models m
ON m.PhotoID = p.PhotoID LEFT JOIN
Landscape l
ON l.PhotoID = p.PhotoID LEFT JOIN
Abstract a
ON a.PhotoID = p.PhotoID
answered Nov 26 '18 at 2:57
Gordon LinoffGordon Linoff
789k35314418
789k35314418
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53473788%2fusing-columns-from-different-tables-to-create-one-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