--- Justin <[EMAIL PROTECTED]> wrote:

> i need to have a record pull data that count is less then 30 in all
> the records, but i need to have it less then 20 in one of the records.
>  Possible in one record set?
> 
> what i have:
> 
> SELECT *
> FROM sessiona
> WHERE sessiona.`count`<30
> 
> <php
> mysql_select_db($database_wellness, $wellness);
> $query_wellnesssessionacount = "SELECT * FROM sessiona WHERE
> sessiona.`count`<30";
> $wellnesssessionacount = mysql_query($query_wellnesssessionacount,
> $wellness) or die(mysql_error());
> $row_wellnesssessionacount = mysql_fetch_assoc($wellnesssessionacount);
> $totalRows_wellnesssessionacount = mysql_num_rows($wellnesssessionacount);
> ?>
> 
> 
> but in one of the records count can needs to be <20
> 
> is there a way to do AND so and so is less then 20?


It's not clear to me what is different about your query when count<30 vs
count<20.  You say that you want this to be in a single record set.  I guess by
this you mean the same result for the query.  You can use UNION to combine two
queries into a single record set IF the columns are the same:

$q = "SELECT * FROM table_a WHERE count<30
      UNION 
      SELECT * FROM table_b WHERE count<20";

This example assumes that table_a and table_b have the same columns.

Maybe if we knew a little more about your data and goals we could be more
helpful.

James

Reply via email to