Require some guidance on SQL code; subquery row error












0















********* WORKING QUERY BELOW *********



SELECT  a.SubmissionId, a.FieldName, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId, FieldName
FROM jos_rsform_submission_values b
WHERE FieldName IN ('Status1', 'Status2', 'Status3', 'Status4', 'Status5', 'Status6', 'Status7', 'Status8', 'Status9', 'Status10')
AND FieldValue = 'Pending'
AND FormId = 28
) AS test

ON a.SubmissionId = test.SubmissionId
WHERE a.FieldName = 'bayanno1' AND a.FormId = 28


*************END*************



I have written the following SQL query:



SELECT SubmissionId,
(SELECT FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'bayanno1')) AS FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'Status1')
AND FieldValue = 'Pending'
AND FormId = 28


I was just wondering if someone could possibly help me in finding the issue of why it's giving me the following error:




#1242 - Subquery returns more than 1 row




I have two fields in the same column. One is "bayanno1" and the other is "Status1".



Each of these have a value when a form is submitted on the website. All submissions are linked with a "SubmissionId". This means that if I have 500 submissions of the form, it won't replace the "Status1" value from "SubmissionID" 150 with the "bayanno1" value from "SubmissionId" 120.



For example:



(FieldName) "bayanno1"  = "12345" (FieldValue) ; 300 (SubmissionId) ;

(FieldName) "Status1" = "Pending" (FieldValue) ; 300 (SubmissionId) ;


I need to replace the VALUE of "Status1" with the VALUE of "bayanno1"; but only for query purposes. I don't want to replace the actual value, only as a visual query.



SO the table with the correct SQL should look like this (I will write a PHP query on my webpage to extract the info from the database and insert into a table, however this table is just a very basic example):



<table>
<tr>
<th>bayanno1</th>
<th>Status1</th>
</tr>
<tr>
<td>12345</td>
<td>12345</td>
</tr>
</table>









share|improve this question

























  • Do a LEFT JOIN instead. And in SQL it's columns, not fields.

    – jarlh
    Nov 22 '18 at 8:04











  • Thanks I will try to do the LEFT JOIN. My mistake on the "fields" wording!

    – MailBlade
    Nov 22 '18 at 8:08













  • how would I go about adding a LEFT JOIN to this query? I read up about it and saw what it does, but I can't quite figure out how to insert it into this specific query.

    – MailBlade
    Nov 22 '18 at 8:27


















0















********* WORKING QUERY BELOW *********



SELECT  a.SubmissionId, a.FieldName, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId, FieldName
FROM jos_rsform_submission_values b
WHERE FieldName IN ('Status1', 'Status2', 'Status3', 'Status4', 'Status5', 'Status6', 'Status7', 'Status8', 'Status9', 'Status10')
AND FieldValue = 'Pending'
AND FormId = 28
) AS test

ON a.SubmissionId = test.SubmissionId
WHERE a.FieldName = 'bayanno1' AND a.FormId = 28


*************END*************



I have written the following SQL query:



SELECT SubmissionId,
(SELECT FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'bayanno1')) AS FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'Status1')
AND FieldValue = 'Pending'
AND FormId = 28


I was just wondering if someone could possibly help me in finding the issue of why it's giving me the following error:




#1242 - Subquery returns more than 1 row




I have two fields in the same column. One is "bayanno1" and the other is "Status1".



Each of these have a value when a form is submitted on the website. All submissions are linked with a "SubmissionId". This means that if I have 500 submissions of the form, it won't replace the "Status1" value from "SubmissionID" 150 with the "bayanno1" value from "SubmissionId" 120.



For example:



(FieldName) "bayanno1"  = "12345" (FieldValue) ; 300 (SubmissionId) ;

(FieldName) "Status1" = "Pending" (FieldValue) ; 300 (SubmissionId) ;


I need to replace the VALUE of "Status1" with the VALUE of "bayanno1"; but only for query purposes. I don't want to replace the actual value, only as a visual query.



SO the table with the correct SQL should look like this (I will write a PHP query on my webpage to extract the info from the database and insert into a table, however this table is just a very basic example):



<table>
<tr>
<th>bayanno1</th>
<th>Status1</th>
</tr>
<tr>
<td>12345</td>
<td>12345</td>
</tr>
</table>









share|improve this question

























  • Do a LEFT JOIN instead. And in SQL it's columns, not fields.

    – jarlh
    Nov 22 '18 at 8:04











  • Thanks I will try to do the LEFT JOIN. My mistake on the "fields" wording!

    – MailBlade
    Nov 22 '18 at 8:08













  • how would I go about adding a LEFT JOIN to this query? I read up about it and saw what it does, but I can't quite figure out how to insert it into this specific query.

    – MailBlade
    Nov 22 '18 at 8:27
















0












0








0








********* WORKING QUERY BELOW *********



SELECT  a.SubmissionId, a.FieldName, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId, FieldName
FROM jos_rsform_submission_values b
WHERE FieldName IN ('Status1', 'Status2', 'Status3', 'Status4', 'Status5', 'Status6', 'Status7', 'Status8', 'Status9', 'Status10')
AND FieldValue = 'Pending'
AND FormId = 28
) AS test

ON a.SubmissionId = test.SubmissionId
WHERE a.FieldName = 'bayanno1' AND a.FormId = 28


*************END*************



I have written the following SQL query:



SELECT SubmissionId,
(SELECT FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'bayanno1')) AS FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'Status1')
AND FieldValue = 'Pending'
AND FormId = 28


I was just wondering if someone could possibly help me in finding the issue of why it's giving me the following error:




#1242 - Subquery returns more than 1 row




I have two fields in the same column. One is "bayanno1" and the other is "Status1".



Each of these have a value when a form is submitted on the website. All submissions are linked with a "SubmissionId". This means that if I have 500 submissions of the form, it won't replace the "Status1" value from "SubmissionID" 150 with the "bayanno1" value from "SubmissionId" 120.



For example:



(FieldName) "bayanno1"  = "12345" (FieldValue) ; 300 (SubmissionId) ;

(FieldName) "Status1" = "Pending" (FieldValue) ; 300 (SubmissionId) ;


I need to replace the VALUE of "Status1" with the VALUE of "bayanno1"; but only for query purposes. I don't want to replace the actual value, only as a visual query.



SO the table with the correct SQL should look like this (I will write a PHP query on my webpage to extract the info from the database and insert into a table, however this table is just a very basic example):



<table>
<tr>
<th>bayanno1</th>
<th>Status1</th>
</tr>
<tr>
<td>12345</td>
<td>12345</td>
</tr>
</table>









share|improve this question
















********* WORKING QUERY BELOW *********



SELECT  a.SubmissionId, a.FieldName, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId, FieldName
FROM jos_rsform_submission_values b
WHERE FieldName IN ('Status1', 'Status2', 'Status3', 'Status4', 'Status5', 'Status6', 'Status7', 'Status8', 'Status9', 'Status10')
AND FieldValue = 'Pending'
AND FormId = 28
) AS test

ON a.SubmissionId = test.SubmissionId
WHERE a.FieldName = 'bayanno1' AND a.FormId = 28


*************END*************



I have written the following SQL query:



SELECT SubmissionId,
(SELECT FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'bayanno1')) AS FieldValue
FROM jos_rsform_submission_values
WHERE FieldName IN (SELECT FieldName
FROM jos_rsform_submission_values
WHERE FieldName = 'Status1')
AND FieldValue = 'Pending'
AND FormId = 28


I was just wondering if someone could possibly help me in finding the issue of why it's giving me the following error:




#1242 - Subquery returns more than 1 row




I have two fields in the same column. One is "bayanno1" and the other is "Status1".



Each of these have a value when a form is submitted on the website. All submissions are linked with a "SubmissionId". This means that if I have 500 submissions of the form, it won't replace the "Status1" value from "SubmissionID" 150 with the "bayanno1" value from "SubmissionId" 120.



For example:



(FieldName) "bayanno1"  = "12345" (FieldValue) ; 300 (SubmissionId) ;

(FieldName) "Status1" = "Pending" (FieldValue) ; 300 (SubmissionId) ;


I need to replace the VALUE of "Status1" with the VALUE of "bayanno1"; but only for query purposes. I don't want to replace the actual value, only as a visual query.



SO the table with the correct SQL should look like this (I will write a PHP query on my webpage to extract the info from the database and insert into a table, however this table is just a very basic example):



<table>
<tr>
<th>bayanno1</th>
<th>Status1</th>
</tr>
<tr>
<td>12345</td>
<td>12345</td>
</tr>
</table>






sql joomla phpmyadmin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 18:11







MailBlade

















asked Nov 22 '18 at 8:02









MailBladeMailBlade

91112




91112













  • Do a LEFT JOIN instead. And in SQL it's columns, not fields.

    – jarlh
    Nov 22 '18 at 8:04











  • Thanks I will try to do the LEFT JOIN. My mistake on the "fields" wording!

    – MailBlade
    Nov 22 '18 at 8:08













  • how would I go about adding a LEFT JOIN to this query? I read up about it and saw what it does, but I can't quite figure out how to insert it into this specific query.

    – MailBlade
    Nov 22 '18 at 8:27





















  • Do a LEFT JOIN instead. And in SQL it's columns, not fields.

    – jarlh
    Nov 22 '18 at 8:04











  • Thanks I will try to do the LEFT JOIN. My mistake on the "fields" wording!

    – MailBlade
    Nov 22 '18 at 8:08













  • how would I go about adding a LEFT JOIN to this query? I read up about it and saw what it does, but I can't quite figure out how to insert it into this specific query.

    – MailBlade
    Nov 22 '18 at 8:27



















Do a LEFT JOIN instead. And in SQL it's columns, not fields.

– jarlh
Nov 22 '18 at 8:04





Do a LEFT JOIN instead. And in SQL it's columns, not fields.

– jarlh
Nov 22 '18 at 8:04













Thanks I will try to do the LEFT JOIN. My mistake on the "fields" wording!

– MailBlade
Nov 22 '18 at 8:08







Thanks I will try to do the LEFT JOIN. My mistake on the "fields" wording!

– MailBlade
Nov 22 '18 at 8:08















how would I go about adding a LEFT JOIN to this query? I read up about it and saw what it does, but I can't quite figure out how to insert it into this specific query.

– MailBlade
Nov 22 '18 at 8:27







how would I go about adding a LEFT JOIN to this query? I read up about it and saw what it does, but I can't quite figure out how to insert it into this specific query.

– MailBlade
Nov 22 '18 at 8:27














1 Answer
1






active

oldest

votes


















1














Edited -- after you have changed the logical requirements of your question...



In simplest terms, you want to extract the FieldValue column value from the rows that contain 28 as the FormId and banyanno1 as the FieldName. Furthermore, you want to filter those results to only show SubmissionIds which have Pending as the value in any of your columns that start with Status (assuming you only have those 10 possibilities).



SELECT a.SubmissionId, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId
FROM jos_rsform_submission_values
WHERE FieldName LIKE 'Status%'
AND FieldValue = 'Pending'
AND FormId = 28
) b
ON a.SubmissionId = b.SubmissionId
WHERE a.FormId = 28
AND a.FieldName = 'bayanno1'


If you want to see all of the columns generated by the join, you can use a.*, b.* in your SELECT clause.



As I have told you repeated times before, when you are seeking MySQL support here or on JoomlaStackExchange, please accompany your question with a sufficient amount of table structure and data so that volunteers who do not have a local copy of the rs_forms_submission_values table can have an easier time of offering assistance. More importantly, volunteers will have no idea that you have 10 different Status rows in your data, so they are doomed to not only fail, but waste their time trying to help you.



If you don't believe me, listen to Strawberry.



Finally, I think you would have received faster support at JoomlaStackExchange because many of the volunteers there are likely to have their own local copy of the table and could write and test solutions directly on their own systems. This is a Joomla related question, so it would certainly be welcome at JSE.






share|improve this answer


























  • HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

    – MailBlade
    Nov 25 '18 at 18:08











  • 1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

    – mickmackusa
    Nov 25 '18 at 21:01











  • 5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

    – mickmackusa
    Nov 25 '18 at 21:01











  • Your question title asks for guidance. I have delivered.

    – mickmackusa
    Nov 25 '18 at 21:02











  • You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

    – MailBlade
    Nov 26 '18 at 5:22











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


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426301%2frequire-some-guidance-on-sql-code-subquery-row-error%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









1














Edited -- after you have changed the logical requirements of your question...



In simplest terms, you want to extract the FieldValue column value from the rows that contain 28 as the FormId and banyanno1 as the FieldName. Furthermore, you want to filter those results to only show SubmissionIds which have Pending as the value in any of your columns that start with Status (assuming you only have those 10 possibilities).



SELECT a.SubmissionId, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId
FROM jos_rsform_submission_values
WHERE FieldName LIKE 'Status%'
AND FieldValue = 'Pending'
AND FormId = 28
) b
ON a.SubmissionId = b.SubmissionId
WHERE a.FormId = 28
AND a.FieldName = 'bayanno1'


If you want to see all of the columns generated by the join, you can use a.*, b.* in your SELECT clause.



As I have told you repeated times before, when you are seeking MySQL support here or on JoomlaStackExchange, please accompany your question with a sufficient amount of table structure and data so that volunteers who do not have a local copy of the rs_forms_submission_values table can have an easier time of offering assistance. More importantly, volunteers will have no idea that you have 10 different Status rows in your data, so they are doomed to not only fail, but waste their time trying to help you.



If you don't believe me, listen to Strawberry.



Finally, I think you would have received faster support at JoomlaStackExchange because many of the volunteers there are likely to have their own local copy of the table and could write and test solutions directly on their own systems. This is a Joomla related question, so it would certainly be welcome at JSE.






share|improve this answer


























  • HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

    – MailBlade
    Nov 25 '18 at 18:08











  • 1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

    – mickmackusa
    Nov 25 '18 at 21:01











  • 5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

    – mickmackusa
    Nov 25 '18 at 21:01











  • Your question title asks for guidance. I have delivered.

    – mickmackusa
    Nov 25 '18 at 21:02











  • You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

    – MailBlade
    Nov 26 '18 at 5:22
















1














Edited -- after you have changed the logical requirements of your question...



In simplest terms, you want to extract the FieldValue column value from the rows that contain 28 as the FormId and banyanno1 as the FieldName. Furthermore, you want to filter those results to only show SubmissionIds which have Pending as the value in any of your columns that start with Status (assuming you only have those 10 possibilities).



SELECT a.SubmissionId, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId
FROM jos_rsform_submission_values
WHERE FieldName LIKE 'Status%'
AND FieldValue = 'Pending'
AND FormId = 28
) b
ON a.SubmissionId = b.SubmissionId
WHERE a.FormId = 28
AND a.FieldName = 'bayanno1'


If you want to see all of the columns generated by the join, you can use a.*, b.* in your SELECT clause.



As I have told you repeated times before, when you are seeking MySQL support here or on JoomlaStackExchange, please accompany your question with a sufficient amount of table structure and data so that volunteers who do not have a local copy of the rs_forms_submission_values table can have an easier time of offering assistance. More importantly, volunteers will have no idea that you have 10 different Status rows in your data, so they are doomed to not only fail, but waste their time trying to help you.



If you don't believe me, listen to Strawberry.



Finally, I think you would have received faster support at JoomlaStackExchange because many of the volunteers there are likely to have their own local copy of the table and could write and test solutions directly on their own systems. This is a Joomla related question, so it would certainly be welcome at JSE.






share|improve this answer


























  • HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

    – MailBlade
    Nov 25 '18 at 18:08











  • 1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

    – mickmackusa
    Nov 25 '18 at 21:01











  • 5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

    – mickmackusa
    Nov 25 '18 at 21:01











  • Your question title asks for guidance. I have delivered.

    – mickmackusa
    Nov 25 '18 at 21:02











  • You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

    – MailBlade
    Nov 26 '18 at 5:22














1












1








1







Edited -- after you have changed the logical requirements of your question...



In simplest terms, you want to extract the FieldValue column value from the rows that contain 28 as the FormId and banyanno1 as the FieldName. Furthermore, you want to filter those results to only show SubmissionIds which have Pending as the value in any of your columns that start with Status (assuming you only have those 10 possibilities).



SELECT a.SubmissionId, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId
FROM jos_rsform_submission_values
WHERE FieldName LIKE 'Status%'
AND FieldValue = 'Pending'
AND FormId = 28
) b
ON a.SubmissionId = b.SubmissionId
WHERE a.FormId = 28
AND a.FieldName = 'bayanno1'


If you want to see all of the columns generated by the join, you can use a.*, b.* in your SELECT clause.



As I have told you repeated times before, when you are seeking MySQL support here or on JoomlaStackExchange, please accompany your question with a sufficient amount of table structure and data so that volunteers who do not have a local copy of the rs_forms_submission_values table can have an easier time of offering assistance. More importantly, volunteers will have no idea that you have 10 different Status rows in your data, so they are doomed to not only fail, but waste their time trying to help you.



If you don't believe me, listen to Strawberry.



Finally, I think you would have received faster support at JoomlaStackExchange because many of the volunteers there are likely to have their own local copy of the table and could write and test solutions directly on their own systems. This is a Joomla related question, so it would certainly be welcome at JSE.






share|improve this answer















Edited -- after you have changed the logical requirements of your question...



In simplest terms, you want to extract the FieldValue column value from the rows that contain 28 as the FormId and banyanno1 as the FieldName. Furthermore, you want to filter those results to only show SubmissionIds which have Pending as the value in any of your columns that start with Status (assuming you only have those 10 possibilities).



SELECT a.SubmissionId, a.FieldValue
FROM jos_rsform_submission_values a
INNER JOIN
(SELECT SubmissionId
FROM jos_rsform_submission_values
WHERE FieldName LIKE 'Status%'
AND FieldValue = 'Pending'
AND FormId = 28
) b
ON a.SubmissionId = b.SubmissionId
WHERE a.FormId = 28
AND a.FieldName = 'bayanno1'


If you want to see all of the columns generated by the join, you can use a.*, b.* in your SELECT clause.



As I have told you repeated times before, when you are seeking MySQL support here or on JoomlaStackExchange, please accompany your question with a sufficient amount of table structure and data so that volunteers who do not have a local copy of the rs_forms_submission_values table can have an easier time of offering assistance. More importantly, volunteers will have no idea that you have 10 different Status rows in your data, so they are doomed to not only fail, but waste their time trying to help you.



If you don't believe me, listen to Strawberry.



Finally, I think you would have received faster support at JoomlaStackExchange because many of the volunteers there are likely to have their own local copy of the table and could write and test solutions directly on their own systems. This is a Joomla related question, so it would certainly be welcome at JSE.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 '18 at 20:50

























answered Nov 25 '18 at 12:48









mickmackusamickmackusa

22.6k103256




22.6k103256













  • HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

    – MailBlade
    Nov 25 '18 at 18:08











  • 1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

    – mickmackusa
    Nov 25 '18 at 21:01











  • 5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

    – mickmackusa
    Nov 25 '18 at 21:01











  • Your question title asks for guidance. I have delivered.

    – mickmackusa
    Nov 25 '18 at 21:02











  • You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

    – MailBlade
    Nov 26 '18 at 5:22



















  • HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

    – MailBlade
    Nov 25 '18 at 18:08











  • 1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

    – mickmackusa
    Nov 25 '18 at 21:01











  • 5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

    – mickmackusa
    Nov 25 '18 at 21:01











  • Your question title asks for guidance. I have delivered.

    – mickmackusa
    Nov 25 '18 at 21:02











  • You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

    – MailBlade
    Nov 26 '18 at 5:22

















HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

– MailBlade
Nov 25 '18 at 18:08





HI mick, thanks for the reply! Appreciate it! I have however solved it I just haven't updated the answer. I will do so now.

– MailBlade
Nov 25 '18 at 18:08













1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

– mickmackusa
Nov 25 '18 at 21:01





1. There is no need to add a.FieldName into your SELECT clause because your query logic requires the value to be static. 2. There is no need to use alias b if you are only going to reference test. 3. There is no need to add FieldName into your subquery's SELECT clause because you don't use it. 4. You have fundamentally changed the logical requirement of your question after receiving an answer -- this is rude because it wastes the time of volunteers.

– mickmackusa
Nov 25 '18 at 21:01













5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

– mickmackusa
Nov 25 '18 at 21:01





5. You still haven't posted any usable data with your question, so your question is Unclear. 6. You posted a solution based on my answer, didn't upvote my solution for being helpful, and you didn't post your solution as an answer. You still have a bit to learn about how to use the Stack Exchange network.

– mickmackusa
Nov 25 '18 at 21:01













Your question title asks for guidance. I have delivered.

– mickmackusa
Nov 25 '18 at 21:02





Your question title asks for guidance. I have delivered.

– mickmackusa
Nov 25 '18 at 21:02













You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

– MailBlade
Nov 26 '18 at 5:22





You certainly have and I thank you for your time and effort into your reply. I appreciate it. No I had an error which says "subquery returns more than one row". There was obviously something wrong with my subquery. So I had to do an INNER JOIN which fixed the "subquery returns more than one row" problem via an SQL query. The database is set up in a bad way due to the component, no by me. To explain it I would have to TeamViewer with someone and show them. Even my mate who helped didn't understand the issue until I shared my screen with him because ALL the values are in ONE column in the table.

– MailBlade
Nov 26 '18 at 5:22


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426301%2frequire-some-guidance-on-sql-code-subquery-row-error%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

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen