SQL enduser

Version 1
    This document was generated from CDN thread

    Created by: Michael Schmidt on 23-04-2012 09:30:26 AM
    Hi,
     
    I just want to have a SQL query of all users with
     
    - userid
    - lastname
    - firstname
    - telephonenumber (from AD)
    - primary extension
     
    which have defined a primay extension at the enduser page.
     
    This SQL query is working but I have at different users in the output 2 or more lines
     
    select e.userid, e.lastname, e.firstname, e.mailid, e.telephonenumber, n.dnorpattern from enduser as e, numplan as n, endusernumplanmap as x where (e.pkid = x.fkenduser and x.fknumplan = n.pkid)
     
    Can anybody help me with this SQL query to get every user with a defined primary extension only once back in the output file and not 2 times or more.
     
    BR
    Michael

    Subject: Re: New Message from Michael Schmidt in Administration XML (AXL) - Administ
    Replied by: Sascha Monteiro on 23-04-2012 05:01:13 PM
    try this;

    select e.userid, e.lastname, e.firstname, e.mailid, e.telephonenumber, n.dnorpattern from enduser as e, numplan as n, endusernumplanmap as x where (e.pkid = x.fkenduser and x.fknumplan = n.pkid and x.tkdnusage = 1)

    Subject: RE: SQL enduser
    Replied by: Michael Schmidt on 24-04-2012 01:49:25 AM
    Hi Sascha,

    thank you very much. Your modified SQL is working fine.

    One other question: Is it also possible to update phones / lines with SQL query?

    Is it also possible to add phones with SQL?

    BR
    Michael