Blessings upon ye monks!

First, this question is total Monk abuse. It's an SQL question, not a perl question (though I will be using the advice generated by this question in a perl script.) However, the Monks are the best people on the net, the smartest, the best able to parse my stupidly-worded questions, sexiest, best dressed etc... If I wanted advice buying a car, I would probably ask on PerlMonks...

If you know a good, more appropriate venue for this kind of question, please feel free to include it with your downvote.

Achem.. the question...

I want to get all the rows out of a table where one particular field has the same value in at least two rows. Er... I want all the rows with matching values in a particular field, and I don't know what the values are, I just want the ones where that value matches.

Here's the background:

I'm looking for duplicate files on my computer.

I have two tables in sqlite like so:

create table files ( id integer primary key, path text unique, md5 int +eger); create table md5s ( id integer primary key, md5 text unique);

A process (writen in perl!) is presently running that is filling up these tables such that each file's md5 integer is the id integer in the md5s table. I want to get the names of files that have the same md5sum, and I'm almost positive I can do that with a select statement but I have no idea how to start.

Did I mention I suck at SQL? I suck at SQL.

Again, any links to good resource for a loser like me would be greatly appreciated and might even lead to fewer stupid questions like this wasting your time.

Let the downvotes begin!

--Pileofrogs


In reply to Dumb SQL Question by pileofrogs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.