Distinct from two tables 2006-06-29 - By Peter Brawley
Back Mark Steudel wrote: > Is there a way get distinct results between pf and sf? > > Select > pf.name, > sf.name > From > tblpropertyfeatures, > tblsuitefeatures > Inner Join tblfeatures AS pf ON tblpropertyfeatures.featureid = pf.id > Inner Join tblfeatures AS sf ON tblsuitefeatures.featureid = sf.id > Do you mean ...
SELECT MIN(TableName) as TableName, id, name FROM ( SELECT 'Table a' as TableName, a.id, a.name FROM tblpropertyfeatures UNION ALL SELECT 'Table b' as TableName, b.id, b.name FROM tblsuitefeatures ) AS tmp GROUP BY id, name HAVING COUNT(*) = 1 ORDER BY ID;
PB
> -- ---- ---- ---- ---- ---- ---- ---- --- > Mark Steudel > NetRiver > Web and Application Developer > 555 Dayton St. > Suite A > Edmonds, WA 98020 > w: http://www.netriver.net > p: 425.741.7014 > > > > >
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Mark Steudel wrote: <blockquote cite="mid000d01c69bc1$1785b5b0$4f00a8c0@(protected)" type="cite"> <pre wrap="">Is there a way get distinct results between pf and sf?
Select pf.name, sf.name From tblpropertyfeatures, tblsuitefeatures Inner Join tblfeatures AS pf ON tblpropertyfeatures.featureid = pf.id Inner Join tblfeatures AS sf ON tblsuitefeatures.featureid = sf.id </pre> </blockquote> Do you mean ...<br> <span> <pre>SELECT MIN(TableName) as TableName, id, name FROM ( SELECT 'Table a' as TableName, a.id, a.name FROM tblpropertyfeatures UNION ALL SELECT 'Table b' as TableName, b.id, b.name FROM tblsuitefeatures ) AS tmp GROUP BY id, name HAVING COUNT(*) = 1 ORDER BY ID; </pre> </span><small>PB<br> </small><br> <blockquote cite="mid000d01c69bc1$1785b5b0$4f00a8c0@(protected)" type="cite"> <pre wrap=""> -- ---- ---- ---- ---- ---- ---- ---- --- Mark Steudel NetRiver Web and Application Developer 555 Dayton St. Suite A Edmonds, WA 98020 w: <a class="moz-txt-link-freetext" href="http://www.netriver.net">http://www .netriver.net</a> p: 425.741.7014
</pre> </blockquote> </body> </html>
No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.7/379 - Release Date: 6/29/2006
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@(protected)
|
|