Problem contructing SQL Request for multiple lines

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Moroney
    New Member
    • Feb 2011
    • 1

    Problem contructing SQL Request for multiple lines

    In order to migrate to a new ERP system i need to recover data from an old tkSQLite database. I am not an SQL expert and am having problems :

    I have 2 tables:

    Table1
    person_id, name, firstname

    Table2
    person_id, telephone_numbe r



    Each person can have several telephone numbers in Table2. What I need to do is select each person and their telephone number(s) on 1 row.



    For example if in Table1 I have

    1, John, Mahony


    and in Table2 I have

    1, +353895604
    1, +353234879
    1, +668497348


    What I need is a request which will give me:

    John, Mahony, +353895604, +353234879, +668497348


    If anyone knows how to do this I would be very greatful,

    Thank you,
    Kevin
    Last edited by Kevin Moroney; Feb 17 '11, 05:02 PM. Reason: typo
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Use GROUP_CONCAT().

    Comment

    Working...