Well, if one checkbox represents ages 1-5, another represents 6-9, and
another represents 10-15, then you have the checkboxes add where
clauses. Here is a pseudocode/basic example:

*START WITH A SELECT*
SQL = "SELECT * FROM TABLE WHERE"

*BUILD THE WHERE CLAUSES*
IF check1 THEN SQL = SQL & " age BETWEEN 1 AND 5 AND"
IF check2 THEN SQL = SQL & " age BETWEEN 6 AND 9 AND"
IF check3 THEN SQL = SQL & " age BETWEEN 10 AND 15 AND"

*TRIM THE UNUSED AND STATEMENT
SQL = left(sql, len(SQL) - 3)

Add some GROUP and ORDER and LIMIT clauses as needed and send the
resulting string to the server.

Regards,
Mike Hillyer
www.vbmysql.com

> -----Original Message-----
> From: vernon [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 19, 2003 12:53 PM
> To: [EMAIL PROTECTED]
> Subject: Complex SQL involving 10 checkboxes
> 
> 
> I'm trying to setup a SQL statement that involes using 10 different 
> checkboxes. The checkboxes repersent age groups that I need 
> to forward to an 
> SQL statement. What would be the easiest way to do this? 
> 
> As I think this through I'm thinking I have to check it 1 and 
> 2 are checked 
> and not 3-9 and so forth which can drive a person to drink 
> espically when I 
> have other SQL statemenst I need to add to it as well.
> 
> Any ideas on the best way to do this? I have this whole thing 
> I was going to 
> post to the list but figured I start out with the basic 
> question first.
> 
> Thanks
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?> [EMAIL PROTECTED]
> 
> 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to