operand should contain 1 column select query mysqlOptimizing multi-table left joinssql error 1241 operand...
You'll find me clean when something is full
What is the difference between ashamed and shamed?
Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?
I can't die. Who am I?
Which aircraft had such a luxurious-looking navigator's station?
Accessing something inside the object when you don't know the key
Hacker Rank: Array left rotation
chrony vs. systemd-timesyncd – What are the differences and use cases as NTP clients?
Whom do I have to contact for a ticket refund in case of denied boarding (in the EU)?
What is the wife of a henpecked husband called?
Why does the 31P{1H} NMR spectrum of cis-[Mo(CO)2(dppe)2] show two signals?
What if I store 10TB on azure servers and then keep the vm powered off?
I am on the US no-fly list. What can I do in order to be allowed on flights which go through US airspace?
How do ISS astronauts "get their stripes"?
What's the difference between a cart and a wagon?
Where was Karl Mordo in Infinity War?
Are small insurances worth it
Linear regression when Y is bounded and discrete
Multiplication via squaring and addition
What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?
How can atoms be electrically neutral when there is a difference in the positions of the charges?
Why is working on the same position for more than 15 years not a red flag?
Can you use a beast's innate abilities while polymorphed?
What's the purpose of these copper coils with resistors inside them in A Yamaha RX-V396RDS amplifier?
operand should contain 1 column select query mysql
Optimizing multi-table left joinssql error 1241 operand should contain 1 columnMySQL JOIN query produces wrong resultMySQL error 1241: Operand should contain 1 column, INTERSECT two subqueriesReturn 2 columns from MySQL subquery?How to handle nested groupings with possible null elements in one querySelect records not associated to a specific tag in a many-to-many relationMYSQL - Operand should contain 1 column(s) - Nested Case statementError Code: 1241. Operand should contain 1 column(s)MySQL auto Increment id has taken but seems like not written to disk
SELECT events.*, location.*, provider.name as provider_name,provider.name_ar as provider_name_ar,
category.name as category_name,
category.name_ar as category_name_ar,
sub_category.name as sub_category_name,sub_category.name_ar as sub_category_name_ar,
(SELECT slider.* FROM slider WHERE slider.subID=events.eventID and slider.type=2) as images,
(SELECT event_benefits.* ,benefits.* FROM `event_benefits` INNER JOIN benefits ON benefits.benefitsID =event_benefits.benefitID WHERE event_benefits.eventID=events.eventID) as benefit,
(SELECT event_kids_tek.* FROM event_kids_tek WHERE event_kids_tek.eventID=events.eventID) as Ticket ,
(SELECT media.* FROM media WHERE media.subID=events.eventID and media.type=1 and media.status=1) as Ticket ,
(SELECT event_kids_age.* FROM event_kids_age WHERE eventID=events.eventID) as kid_age,
(SELECT event_kids_gender.* FROM event_kids_gender WHERE eventID=events.eventID) as gender
FROM events
INNER JOIN category ON category.categoryID =events.cat_id
INNER JOIN sub_category ON events.sub_id = sub_category.subCatID
INNER JOIN provider ON provider.providerID=events.prv_id
INNER JOIN location ON location.id=events.loc_id
WHERE events.status=1
That query though gives me an error:
#1241 - Operand should contain 1 column(s)
What stumps me is that I would think that this query would work with no problem. Selecting columns, then selecting two more from another table, and continuing on from there. I just can't figure out what the problem is.
Is there a simple fix to this, or another way to write my query?
mysql
bumped to the homepage by Community♦ 4 mins 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 |
SELECT events.*, location.*, provider.name as provider_name,provider.name_ar as provider_name_ar,
category.name as category_name,
category.name_ar as category_name_ar,
sub_category.name as sub_category_name,sub_category.name_ar as sub_category_name_ar,
(SELECT slider.* FROM slider WHERE slider.subID=events.eventID and slider.type=2) as images,
(SELECT event_benefits.* ,benefits.* FROM `event_benefits` INNER JOIN benefits ON benefits.benefitsID =event_benefits.benefitID WHERE event_benefits.eventID=events.eventID) as benefit,
(SELECT event_kids_tek.* FROM event_kids_tek WHERE event_kids_tek.eventID=events.eventID) as Ticket ,
(SELECT media.* FROM media WHERE media.subID=events.eventID and media.type=1 and media.status=1) as Ticket ,
(SELECT event_kids_age.* FROM event_kids_age WHERE eventID=events.eventID) as kid_age,
(SELECT event_kids_gender.* FROM event_kids_gender WHERE eventID=events.eventID) as gender
FROM events
INNER JOIN category ON category.categoryID =events.cat_id
INNER JOIN sub_category ON events.sub_id = sub_category.subCatID
INNER JOIN provider ON provider.providerID=events.prv_id
INNER JOIN location ON location.id=events.loc_id
WHERE events.status=1
That query though gives me an error:
#1241 - Operand should contain 1 column(s)
What stumps me is that I would think that this query would work with no problem. Selecting columns, then selecting two more from another table, and continuing on from there. I just can't figure out what the problem is.
Is there a simple fix to this, or another way to write my query?
mysql
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
All these(SELECT table.*......)
are wrong. stackoverflow.com/questions/50149404/…
– McNets
Jan 17 at 14:49
add a comment |
SELECT events.*, location.*, provider.name as provider_name,provider.name_ar as provider_name_ar,
category.name as category_name,
category.name_ar as category_name_ar,
sub_category.name as sub_category_name,sub_category.name_ar as sub_category_name_ar,
(SELECT slider.* FROM slider WHERE slider.subID=events.eventID and slider.type=2) as images,
(SELECT event_benefits.* ,benefits.* FROM `event_benefits` INNER JOIN benefits ON benefits.benefitsID =event_benefits.benefitID WHERE event_benefits.eventID=events.eventID) as benefit,
(SELECT event_kids_tek.* FROM event_kids_tek WHERE event_kids_tek.eventID=events.eventID) as Ticket ,
(SELECT media.* FROM media WHERE media.subID=events.eventID and media.type=1 and media.status=1) as Ticket ,
(SELECT event_kids_age.* FROM event_kids_age WHERE eventID=events.eventID) as kid_age,
(SELECT event_kids_gender.* FROM event_kids_gender WHERE eventID=events.eventID) as gender
FROM events
INNER JOIN category ON category.categoryID =events.cat_id
INNER JOIN sub_category ON events.sub_id = sub_category.subCatID
INNER JOIN provider ON provider.providerID=events.prv_id
INNER JOIN location ON location.id=events.loc_id
WHERE events.status=1
That query though gives me an error:
#1241 - Operand should contain 1 column(s)
What stumps me is that I would think that this query would work with no problem. Selecting columns, then selecting two more from another table, and continuing on from there. I just can't figure out what the problem is.
Is there a simple fix to this, or another way to write my query?
mysql
SELECT events.*, location.*, provider.name as provider_name,provider.name_ar as provider_name_ar,
category.name as category_name,
category.name_ar as category_name_ar,
sub_category.name as sub_category_name,sub_category.name_ar as sub_category_name_ar,
(SELECT slider.* FROM slider WHERE slider.subID=events.eventID and slider.type=2) as images,
(SELECT event_benefits.* ,benefits.* FROM `event_benefits` INNER JOIN benefits ON benefits.benefitsID =event_benefits.benefitID WHERE event_benefits.eventID=events.eventID) as benefit,
(SELECT event_kids_tek.* FROM event_kids_tek WHERE event_kids_tek.eventID=events.eventID) as Ticket ,
(SELECT media.* FROM media WHERE media.subID=events.eventID and media.type=1 and media.status=1) as Ticket ,
(SELECT event_kids_age.* FROM event_kids_age WHERE eventID=events.eventID) as kid_age,
(SELECT event_kids_gender.* FROM event_kids_gender WHERE eventID=events.eventID) as gender
FROM events
INNER JOIN category ON category.categoryID =events.cat_id
INNER JOIN sub_category ON events.sub_id = sub_category.subCatID
INNER JOIN provider ON provider.providerID=events.prv_id
INNER JOIN location ON location.id=events.loc_id
WHERE events.status=1
That query though gives me an error:
#1241 - Operand should contain 1 column(s)
What stumps me is that I would think that this query would work with no problem. Selecting columns, then selecting two more from another table, and continuing on from there. I just can't figure out what the problem is.
Is there a simple fix to this, or another way to write my query?
mysql
mysql
edited Jan 17 at 14:47
tinlyx
1,24231130
1,24231130
asked Jan 17 at 14:00
Shatha Abu SbeitShatha Abu Sbeit
12
12
bumped to the homepage by Community♦ 4 mins 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♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
All these(SELECT table.*......)
are wrong. stackoverflow.com/questions/50149404/…
– McNets
Jan 17 at 14:49
add a comment |
All these(SELECT table.*......)
are wrong. stackoverflow.com/questions/50149404/…
– McNets
Jan 17 at 14:49
All these
(SELECT table.*......)
are wrong. stackoverflow.com/questions/50149404/…– McNets
Jan 17 at 14:49
All these
(SELECT table.*......)
are wrong. stackoverflow.com/questions/50149404/…– McNets
Jan 17 at 14:49
add a comment |
1 Answer
1
active
oldest
votes
When you do this:
SELECT x,
( SELECT ... ) AS y,
z
FROM ...
That subquery (for y
) is expected to deliver one value, not several.
To get multiple columns from two tables (as you are doing for other tables):
SELECT a.c1, a.c2, b.c3, b.c4
FROM a
JOIN b ON (how the two tables are related);
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%2f227381%2foperand-should-contain-1-column-select-query-mysql%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
When you do this:
SELECT x,
( SELECT ... ) AS y,
z
FROM ...
That subquery (for y
) is expected to deliver one value, not several.
To get multiple columns from two tables (as you are doing for other tables):
SELECT a.c1, a.c2, b.c3, b.c4
FROM a
JOIN b ON (how the two tables are related);
add a comment |
When you do this:
SELECT x,
( SELECT ... ) AS y,
z
FROM ...
That subquery (for y
) is expected to deliver one value, not several.
To get multiple columns from two tables (as you are doing for other tables):
SELECT a.c1, a.c2, b.c3, b.c4
FROM a
JOIN b ON (how the two tables are related);
add a comment |
When you do this:
SELECT x,
( SELECT ... ) AS y,
z
FROM ...
That subquery (for y
) is expected to deliver one value, not several.
To get multiple columns from two tables (as you are doing for other tables):
SELECT a.c1, a.c2, b.c3, b.c4
FROM a
JOIN b ON (how the two tables are related);
When you do this:
SELECT x,
( SELECT ... ) AS y,
z
FROM ...
That subquery (for y
) is expected to deliver one value, not several.
To get multiple columns from two tables (as you are doing for other tables):
SELECT a.c1, a.c2, b.c3, b.c4
FROM a
JOIN b ON (how the two tables are related);
answered Jan 17 at 21:52
Rick JamesRick James
43k22259
43k22259
add a comment |
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%2f227381%2foperand-should-contain-1-column-select-query-mysql%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
All these
(SELECT table.*......)
are wrong. stackoverflow.com/questions/50149404/…– McNets
Jan 17 at 14:49