• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Multiple WHERE in MYSQL?

TheBigK

Well-known member
#1
I wish to fetch data in the following format :

Username | articles_last_month | total_articles

Now, my query that lets me fetch the first two column looks like this :-
Code:
SELECT username, COUNT (blah) as articles_last_month FROM xf_thread
INNER JOIN ....
ON ....
WHERE condition 1 AND date between (condition to choose first and last date of last month)
It totally ignores the third column, the total_articles for which I will have to create an option to the WHERE condition. I'm wondering if it's possible to do it in a single query than write a separate query just to get the third column values?

I tried appending 'AND' at the end of above query; but it creates an error.
 

Daniel Hood

Well-known member
#2
Please show the full query or at least the real where clause. We can't troubleshoot this because you're omitting the part that isn't working, condition 1 isn't a valid constraint, and your between condition isn't legit either.