MySQL Forums
Forum List  »  Newbie

Re: looping through queries
Posted by: Jordan Pritt
Date: July 18, 2017 01:51PM

WHERE IF((SELECT(SELECT COUNT(*) FROM test_table WHERE click='yes' AND (prod='x' OR prod='y' OR prod='z'))/(SELECT(SELECT COUNT(*) FROM test_table WHERE click='no' AND (prod='x' OR prod='y' OR prod='z'))))>=0.1,(sub query for true),(sub query for false));

The dilemma here is that this evaluates the first prod from test_table true/false and then quires 2-10 differing rows. I am trying to find an effective way to do this same selection structure to what those queries bring up from either true/false, or a way to do this to all the rows resulting from a query ran before the if() so I can then change the quired rows depending on whether it is true/false. And I am using a large table that would be extremely confusing for the scope of this question.

So no ex: WHERE x='c' (which is equivalent to 1+1=2 and the first part of every WHERE clause tutorial) and the vast majority of tutorials I have already sifted through have not covered what I need to know. And of course I went to Google first.

Options: ReplyQuote


Subject
Written By
Posted
July 18, 2017 09:42AM
Re: looping through queries
July 18, 2017 01:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.