Announcement

Collapse
No announcement yet.

Repeat Record n times

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Repeat Record n times

    I'm working in a warehouse management applications, and I want to create labels for each entry, the problem it's in the entry table reflects the total qty of each element and I want a label for element, for example if I received 20 units of HDD seagate I want to generete 20 labels.

    How I can do that?

  • #2
    That is a design issue. Say your table is:
    mytable:

    element varchar(128)
    label varchar(128)
    cnt integer

    Then make a simple table with say 500 entries in it:
    mynrs:
    nr integer

    fill the table with values 1 thru 500

    Then create a cross query
    select element,label,cnt,nr from mytable,mynrs where mynrs<=:mymaxvalue and element=:myelement order by element,label,nr
    and you get a list of mymaxvalue long containg all the elements.
    Then just print the output..

    Hoping that I didnt type something wrong but this would be a simple solution. Of course there are other solutions including ones with limit by...

    Comment


    • #3
      Thanks Solved with an Inner Join, following your idea
      SELECT
      TestWarehouse.Articulos.Part_Numer,
      TestWarehouse.Articulos.Description,
      TestWarehouse.Articulos.Qty,
      TestWarehouse.mynrs.nr

      FROM
      TestWarehouse.Articulos
      INNER JOIN
      TestWarehouse.mynrs
      ON
      (
      TestWarehouse.Articulos.Qty >= TestWarehouse.mynrs.nr)
      ORDER BY
      TestWarehouse.Articulos.Description ASC ;

      Comment

      Working...
      X