A guess... select t1.cat1 as result from t1 union select t2.cat2 as result from t1 union select t3.cat3 as result from t1 union select t4.cat4 as result from t1 group by result order by result * * Cal Evans * Techno-Mage * http://www.calevans.com *
----- Original Message ----- From: "Doug Coning" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 23, 2003 1:12 PM Subject: Is this possible? > Is this possible in MySQL without using a temporary table with multiple SQL > commands: > > I am trying to SELECT the results of multiple columns into 1 column or > Alias, > group them and sort them. > > So if I had a table with 4 fields: Cat1, Cat2, Cat3, & Cat4 like such: > > +-----+------+-----+------+ > | Cat1| Cat2 | Cat3| Cat4 | > +-----+------+-----+------+ > | F | A | | A | > | D | C | H | A | > | G | | | | > | F | B | I | A | > +-----+------+-----+------+ > > It would select all the values, merge them into 1 column, group them, and > sort them like such so that the result would be a single column, returning > only 1 instance of each returned value: > > +--------+ > | Result | > +--------+ > | A | > | B | > | C | > | D | > | F | > | G | > | H | > | I | > +--------+ > > Is there as singe Select command that can do this? Right now I am using a > temporary table where I first clear out the values, then copy each column > one at a time over into the tables... It works, however, I was wondering if > there is an easier way to get the single column result with all the merged > information without having to use a temporary table... > > Thanks, > > Doug Coning > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php