none
Dataset and Mysql Database RRS feed

  • Question

  • Hello,

    How can I concatenate 3 Integer columns using a MySql Database Engine ?

    suppose I have the following SQL Query


    SELECT        customers.cid, customers.firstname, customers.lastname, customers.company, customers.RegdateMM, customers.RegdateDD, customers.RegdateYYYY, 
                             items.ItemID, items.barcode, items.itemname, items.status, items.entrydd, items.entrymm, items.entryYYYY, items.deliverydd, items.deliverymm
    FROM            customers INNER JOIN
                             items ON customers.cid = items.cid
    ORDER BY customers.cid
    In the code above the concerned columns are:

    customers.RegdateMM, customers.RegdateDD, customers.RegdateYYYY

    Thank you


    Wednesday, September 9, 2009 5:13 PM

Answers

  • I do not know the syntax of MySQL, but in SQL Server, it would look something like

    SELECT        customers.cid, customers.firstname, customers.lastname, customers.company, CONVERT(customers.RegdateMM, VARCHAR(20))+  CONVERT(customers.RegdateDD, VARCHAR(20)) + CONVERT(customers.RegdateYYYY, VARCHAR(20)),
                             items.ItemID, items.barcode, items.itemname, items.status, items.entrydd, items.entrymm, items.entryYYYY, items.deliverydd, items.deliverymm
    FROM            customers INNER JOIN
                             items ON customers.cid = items.cid
    ORDER BY customers.cid

    Val Mazur (MVP) http://www.xporttools.net
    • Marked as answer by Yichun_Feng Tuesday, September 15, 2009 3:14 AM
    Thursday, September 10, 2009 10:33 AM
    Moderator