Using multiple values in a column

(2 posts) (2 voices)


No tags yet.

  1. brycedcamp, Member

    I have a simple under stock report. The SQL:

    SELECT strStock AS 'Part',
    strDescription AS 'Description',
    strVendor AS 'Vendor',
    decQuantityOnHand AS 'On Hand',
    decQuantityOnOrder AS 'On Order',
    decQuantityOnBO AS 'Back Order',
    decQuantityCommitted AS 'Committed',
    decMinimumQuantity AS 'Min',
    decMaximumQuantity AS 'Max',
    ((-[decQuantityOnOrder] + decQuantityOnBO) - decQuantityCommitted) AS 'Actual Avail[actualavail]',
    (select SUM(decQuantity) from ST2005.dbo.IN_History WHERE strStock=a.strStock AND dteTranDate > CAST((GETDATE() - 180) AS DATE)) AS 'Ordered last 180 days',
    test2' AS 'testfield'
    FROM ST2005.dbo.IN_Master AS a
    WHERE decQuantityOnHand < decQuantityOnOrder;

    I would like to add the last three dates the product was ordered to a column. is that possible, or will I need another row for each date?

  2. myDBR Team, Key Master

    If you want to put the dates in one column, you can use MySQL's group_concat-function.

    myDBR Team


You must log in to post.