Hi,

I think the answer is to hash it all but, here is my situation..

querying a stats table there are numerous queries that need to be made. It's nice to know that we have had so many visitors for such a small business (300k in 12 mths) but outputting that meaningfully is proving tricky. here are two 'contradictory' queries.

Code:
 my $sth = $connect->prepare("select 
                                stat.Domain_Viewed
                               from
                                statistics AS stat
                             inner 
                               join business_details AS bd
                              on bd.web_url = stat.Domain_Viewed 
                              where bd.business_id = ?
                                group by stat.Session_ID
                               ") or die "prepare statement failed: $DBI::errstr\n";

Code:
 my $sth = $connect->prepare("select 
                                stat.Domain_Viewed
                               from
                                statistics AS stat
                             inner 
                               join business_details AS bd
                              on bd.web_url = stat.Domain_Viewed 
                              where bd.business_id = ?
                               # group by stat.Session_ID
                               ") or die "prepare statement failed: $DBI::errstr\n";
The GROUP BY clause is the only difference between them. loads of other 'contradictory' queries to be made for one page output so should I just get all the table data as required and post process it? Or should I do several queries - such as UNION or UNION ALL?

(don't worry about the naming convention etc because that was one of my first MySQL tables and I shall alter it).

Any pointers would be very appreciated.

bazz