Michael Collins a écrit : > > I am trying to normalize some MySQL tables and need to move a few > columns from one table to another while maintaining the relationship > between the two. I realize I cannot do a subselect, but in effect > what I am wanting to do is to select the Distinct rows for the column > ProductID and then select the columns from the rows that are found by > the DISTINCT. This is the kind of query I have in mind: > > SELECT DISTINCT ProductID > > (SELECT > ProductID, > SmImage, > ProductName, > Description, > LgImage > WHERE ProductID=ProductID) > > FROM productSKU > > How do I rewrite this query to get what I am after? > > -- > Michael > __ > ||| Michael Collins ||| > ||| Kuwago Web Services ||| mailto:[EMAIL PROTECTED] > ||| Seattle, WA, USA ||| http://www.lassodev.com >
Hi, Have you tried : SELECT DISTINCT ProductID,SmImage,ProductName,Description,LgImage FROM productSKU ? If all records with same ProductID have also the same values for other selected fields it should work; otherwise, your normalization has some problem. Regards -- Joseph Bueno NetClub/Trader.com --------------------------------------------------------------------- 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