Solved

mysql need to use COUNT (group function)  within WHERE clause

Posted on 2014-02-28
2
621 Views
Last Modified: 2014-02-28
here's a simplified case that does not work - it is dumbed-down to have a simple
form that shows the error:   invalid use of group function

select ID from tblMembers where count(ID=177)=1

how can i include an "insulated"  COUNT  within  a where clause?
is there a way to make a sub-query?

the actual usage is in the context:

    SELECT ....  FROM tblA, tblB WHERE  tblA.stuff=$C1   AND   COUNT( tblB.stuff=$C1 ) =0

tblA and tblB are unrelated,  unrelational.   i just need them to be within a single query due to the called context of a single shell command.

thanks
0
Comment
Question by:willsherwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
regmigrant earned 500 total points
ID: 39896424
how about
 SELECT ....  FROM tblA WHERE  tblA.stuff=$C1   AND
    $C1 = (select  COUNT( tblB.stuff) from tblb)
0
 

Author Comment

by:willsherwood
ID: 39896446
this gives me a syntax that i think i can adapt to get the desired behavior.
thanks for the structural tip !
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question