Click here to get back home

getting unique records

 HomeNewsGroups | Search

mailing.database.mysql - MySQL database issues discussed in this best MySQL group in USENET 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
getting unique records Dave 11-23-2006
Posted by Dave on November 23, 2006, 9:58 am
Please log in for more thread options
I'm in need of a little sql help.

How do i get a list of ids from one table that do not have the same ids in
another table?

I hope that makes sense.



Posted by Michael Austin on November 23, 2006, 2:16 pm
Please log in for more thread options
Dave wrote:

show/hide quoted text

not exact syntax, but gives you an idea...


select a.id, b.id from table1 a left join table2 b on a.id=b.id where b.id is
null;

show/hide quoted text
Query OK, 0 rows affected (2.27 sec)

show/hide quoted text
Query OK, 0 rows affected (1.60 sec)

show/hide quoted text
Query OK, 5 rows affected (0.24 sec)
Records: 5 Duplicates: 0 Warnings: 0

show/hide quoted text
Query OK, 4 rows affected (0.15 sec)
Records: 4 Duplicates: 0 Warnings: 0

show/hide quoted text
null;
+------+------+
| c1 | c1 |
+------+------+
| 3 | NULL |
+------+------+
1 row in set (0.10 sec)

--
Michael Austin.
DBA Consultant
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)

Posted by Dave on November 24, 2006, 5:52 am
Please log in for more thread options
Thanks very much Michael, that's exactly what i need.

show/hide quoted text



Similar ThreadsPosted
Returning unique records October 27, 2005, 12:35 pm
All Records From Table A - All Records From Table B - Join Alike Records October 3, 2006, 11:24 am
varchar and unique December 19, 2005, 8:13 am
inserting unique value June 21, 2007, 9:20 am
Creating an unique record id ?? October 9, 2005, 1:15 pm
How to get the number of each unique items? October 28, 2005, 7:43 pm
Assigning unique ID to distinct values June 20, 2005, 12:44 pm
making a table with unique entries October 11, 2005, 11:44 am
Unique table version record July 26, 2006, 5:52 am
How to generate unique no. with java and mysql April 8, 2005, 4:36 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy