Your title description is very poor. It's too vague. Besides, the problem is not "a" huge problem, it's "your" huge problem. Please use something a little more descriptive next time.

I'm not exactly sure what you're asking. I assume you know how to query your database, and how to insert those results into another table. That only leaves the uniqueness check. Try using a hash to enforce uniqueness. Something like this:

use strict; my @values = qw(mon10 mon11 mon12 wed15 wed16 wed17 wed18 mon9 mon10 m +on11); @values = sort keys %{({ map { $_ => 1} @values })};

If you don't mind using an explicit temporary hash, you can use this instead:

my %uniq = map { $_ => 1} @values; @values = sort keys %uniq;

Lastly, your database itself might be able to guarantee uniqueness of the rows. I know Oracle has the keyword DISTINCT that eliminates duplicates. You might want to check MySQL for something similar. (You'd also need to expand the ranges in the database too. Oracle can do that, but I'm not sure about MySQL.)


In reply to Re: huge problem! by blssu
in thread Inserting sequences without duplicates by husoft

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.