EasyCFM.COM ColdFusion Forums / MySQL Related Issues / Less than or equal to 5-case

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Less than or equal to 5-case

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

riogrande
02-29-2008 @ 11:05 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 509
Joined: Mar 2003

This works fine but now I want to add a part in where if the country_count is less that or equal to 5 then the string "Less than #avariable# visitors". I have had a crack at the additional sql-what do I need to do? Thank-you
SELECT clientinfo.countryid, countries.country, COUNT(*) AS country_count
FROM clientinfo
JOIN countries ON clientinfo.countryid = countries.countryid
WHERE month(clientinfo.visit) = #url.monthnowis#
AND day(clientinfo.visit) = #url.daynowis#
GROUP BY country
ORDER BY country_count

but I want to add this which has really been the problem all along:

SELECT CASE WHEN country_count >= 5 THEN country ELSE 'LESS THAN #NEWVALUE# VISITS' END AS country

How do I do that? Thanks


Website Designed and Developed by Pablo Varando.