Ryan, As you probably found out, union is only available in version 4 of mysql.
As you're using PHP anyway, why don't you just break it up into 5 separate selects and combine the results in PHP? Andy > -----Original Message----- > From: Ryan A [mailto:[EMAIL PROTECTED] > Sent: 15 September 2003 10:41 > To: < > Subject: Blasted #$%$^$^ host has v3.23 when i need UNION > > > Hi guys, > First of all let me warn you, i am very much a newbie to mysql, i > am pretty > good with the basics like selecting,deleting,updateing etc but > after that i > get a dazed look in my eyes with complex sql :-D > > Now that you have been warned let me explain, on my local machine > (win2k) i > have php and mysql 4.0 installed for testing purposes, I have > created a site > locally and then uploaded it only to find out that because of > UNION it wont > run as my host is on version 3.23. > > I then searched google as i was pretty sure that i am not the only person > who ran into this problem and found 2 places with some kind of explanation > of which this seems to be the best: (the other one is the online manual) > http://jinxidoru.com/tutorials/union.html > > but being a newbie and never having used "join" in my life, (at least not > knowingly) this is @$#$%^$ confusing. > > Below is my union select statement, can somebody please show me how to > convert it so it will work on 3x please? > (This one is the actual php code i am using but if you dont understand it > there is the normal sql below this one) > > $tt = "SELECT COUNT(*), 'C1' FROM shared WHERE user ='".$mmmy_user."' and > ccno=".$mmmy_ccno." UNION SELECT COUNT(*), 'C2' FROM dedicated where > user='".$mmmy_user."' and ccno=".$mmmy_ccno." UNION SELECT > COUNT(*), 'C3' > FROM reseller WHERE user ='".$mmmy_user."' and ccno=".$mmmy_ccno." UNION > SELECT COUNT(*), 'C4' FROM colocated WHERE user ='".$mmmy_user."' and > ccno=".$mmmy_ccno." UNION SELECT COUNT(*), 'C5' FROM freehosting > WHERE user > ='".$mmmy_user."' and ccno=".$mmmy_ccno; > > // Normal version > > SELECT COUNT(*), 'C1' FROM shared WHERE user ='testing' and ccno=1 > UNION > SELECT COUNT(*), 'C2' FROM dedicated where user='testing' and ccno=1 > UNION > SELECT COUNT(*), 'C3' FROM reseller WHERE user ='testing' and ccno=1 > UNION > SELECT COUNT(*), 'C4' FROM colocated WHERE user ='testing' and ccno=1 > UNION > SELECT COUNT(*), 'C5' FROM freehosting WHERE user ='testing' and ccno=1; > > Thanks in advance and have a fantastic day, even though its monday... > :-D > > Cheers, > -Ryan > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]