Note that there are some explanatory texts on larger screens.

plurals
  1. POThis is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression
    primarykey
    data
    text
    <p>I have a problem executing this query. Please see my code below.</p> <pre><code> SELECT (SELECT COUNT(FilteredAppointment.activitytypecodename) AS Expr1 FROM FilteredBusinessUnit INNER JOIN FilteredSystemUser ON FilteredBusinessUnit.businessunitid = FilteredSystemUser.businessunitid INNER JOIN FilteredAppointment ON FilteredSystemUser.systemuserid = FilteredAppointment.createdby WHERE (FilteredBusinessUnit.name IN (@Branch))) AS Appointment, (SELECT COUNT(FilteredLead.leadid) AS Expr1 FROM FilteredBusinessUnit AS FilteredBusinessUnit_7 INNER JOIN FilteredSystemUser AS FilteredSystemUser_7 ON FilteredBusinessUnit_7.businessunitid = FilteredSystemUser_7.businessunitid INNER JOIN FilteredLead ON FilteredSystemUser_7.systemuserid = FilteredLead.createdby WHERE (FilteredBusinessUnit_7.name IN (@Branch)) AND (FilteredLead.new_referraltypename = 'Bank Staff')) AS Bank_Staff_Referral, (SELECT COUNT(FilteredLead_3.leadid) AS Expr1 FROM FilteredBusinessUnit AS FilteredBusinessUnit_6 INNER JOIN FilteredSystemUser AS FilteredSystemUser_6 ON FilteredBusinessUnit_6.businessunitid = FilteredSystemUser_6.businessunitid INNER JOIN FilteredLead AS FilteredLead_3 ON FilteredSystemUser_6.systemuserid = FilteredLead_3.createdby WHERE (FilteredBusinessUnit_6.name IN (@Branch)) AND (FilteredLead_3.new_referraltypename = 'Existing Customer')) AS Customer_Referral, (SELECT COUNT(Filterednew_discoveryinterview.activityid) AS Expr1 FROM FilteredBusinessUnit AS FilteredBusinessUnit_5 INNER JOIN FilteredSystemUser AS FilteredSystemUser_5 ON FilteredBusinessUnit_5.businessunitid = FilteredSystemUser_5.businessunitid INNER JOIN Filterednew_discoveryinterview ON FilteredSystemUser_5.systemuserid = Filterednew_discoveryinterview.createdby WHERE (FilteredBusinessUnit_5.name IN (@Branch))) AS Discovery_Interview, (SELECT COUNT(FilteredLead_2.leadid) AS Expr1 FROM FilteredBusinessUnit AS FilteredBusinessUnit_4 INNER JOIN FilteredSystemUser AS FilteredSystemUser_4 ON FilteredBusinessUnit_4.businessunitid = FilteredSystemUser_4.businessunitid INNER JOIN FilteredLead AS FilteredLead_2 ON FilteredSystemUser_4.systemuserid = FilteredLead_2.createdby WHERE (FilteredBusinessUnit_4.name IN (@Branch))) AS Generated_Leads, </code></pre> <p>(SELECT name FROM FilteredBusinessUnit WHERE (FilteredBusinessUnit.name IN (@Branch ))) AS BRANCH</p> <p>`</p> <p>The code returns results for query run against a single branch. However, an error is thrown with message" Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, &lt;, &lt;= , >, >= or when the subquery is used as an expression. " When I select more than one branch. My guess is that the error occurs when the last block of select statement is run. </p> <p>How can I write this query to display results for multiple branches</p> <p>Please help me </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload