[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Distinct from two tables
From:       Peter Brawley <peter.brawley () earthlink ! net>
Date:       2006-06-29 21:30:57
Message-ID: 44A44691.9070701 () earthlink ! net
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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
>
>
>
>
>   

[Attachment #5 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mark Steudel wrote:
<blockquote cite="mid000d01c69bc1$1785b5b0$4f00a8c0@persephonie"
 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@persephonie"
 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>

--------------040603080403040500030003--

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@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic