Administration XML Developer Forums

Combination View Flat View Tree View
Threads [ Previous | Next ]
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

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)

RE: SQL enduser
Answer
4/24/12 6:49 AM as a reply to Sascha Monteiro.
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