Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query help needed - mysql 3.23.58 linux 1

Status
Not open for further replies.

thedaver

IS-IT--Management
Jul 12, 2001
2,741
US
I have this query working:

Code:
SELECT ip,count(ip) as count FROM banips WHERE date BETWEEN (CURDATE() - INTERVAL 1 DAY) AND CURDATE() group by ip order by count asc;

I am having a great of trouble adding the condition

"where count > 5"

I receive error "ERROR 1054: Unknown column 'count' in 'where clause'"

I'm wondering if its possible to make such a criteria apply for a value derived from count(ip)

Thanks.

D.E.R. Management - IT Project Management Consulting
 
Yup! This worked
Code:
SELECT ip,count(ip) as count FROM banips WHERE date BETWEEN (CURDATE() - INTERVAL 1 DAY) AND CURDATE() group by ip having count > 5 order by count asc;

D.E.R. Management - IT Project Management Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top