0

Hiii I want to use select in select clause
this is my statement which got an error:

Select count(*) as cnt, (select count (answer_q1) from answers where  (answer_q1 = 'ضعيف'))as  a_q1
FROM            Answers

and this is the error:

Error in SELECT clause: expression near 'SELECT'.
Error in SELECT clause: expression near 'FROM'.
Missing FROM clause.
Unable to parse query text.


DO YOU ANY OTHER WAY TO WRITE THE STATEMENT AND GET SAME RESULT?????? hELP ME PLEASE

3
Contributors
7
Replies
10
Views
8 Years
Discussion Span
Last Post by Sirisha_2
0

Here is an example. See if you can modify it to suit your needs:

Select Count(*) As CustCnt,
(Select Count(*) From Invoice Where Invoice.CustNumber = Customer.CustNumber) As InvCnt
From Customer
Group By Customer.CustNumber
-1

You are flat horrible at copy+paste. You read my posts, think you memorize the syntax, then form the query wrong again. Please copy+paste and change table/column names.

insert into Results (cnt, a_q1) 
SELECT
(select count(*) from Answers) as cnt, 
(select count(*) from Answers where answer_q1='ضعيف')as a_q1
0

No this solution is not working for me.
I am getting error like "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."

ANd my query is :

INSERT INTO #ReplaceCards(s_no,card_number)

SELECT
(SELECT splitdata from splitfn('1,2,3,4,5',',')) AS s_no,
(SELECT splitdata from splitfn('6,7,8,9,10',',')) AS card_number

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.