" /> cfg database question... - Genesys CTI User Forum

Author Topic: cfg database question...  (Read 4685 times)

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

tony

  • Guest
cfg database question...
« on: February 28, 2011, 11:49:50 AM »
Advertisement
I reckon this should be easy because I've definitely worked it out before - but I can't remember how I did it... :(

I need to find a reference between [b]cfg_Agent[/b] and [b]cfg_Person[/b] within the database Table structure.  I've tried the DBID's, CSID's and pretty much everything else I can think of but still not able to find the correct pair of Foreign/Primary keys.  I expect that there is an interim Table ([b]cfg_???[/b]) which might be used to connect them but I haven't found it yet...

Help please???

Thanks!

TT

Offline borkokrz

  • Full Member
  • ***
  • Posts: 154
  • Karma: 6
Re: cfg database question...
« Reply #1 on: February 28, 2011, 12:04:38 PM »
cfg_agent ? are you sure ? or do you mean cfg_agent_login ? check cfg_login_info table - it links persons to agent_logins.
« Last Edit: February 28, 2011, 12:06:26 PM by borkokrz »

tony

  • Guest
Re: cfg database question...
« Reply #2 on: February 28, 2011, 12:24:02 PM »
Yes - that's what I meant...  ;D

But I just tried this, in the same Query;

cfg_Agent_Login.dbid = cfg_Login_Info.Agent_Login_dbid
and also
cfg_Login_Info.Person_dbid = cfg_Person.dbid

- returns 35,000+ rows - even with duplicates removed...

Not sure what I am doing wrong...?

Thanks!

TT

[quote author=borkokrz link=topic=6215.msg27060#msg27060 date=1298894678]
cfg_agent ? are you sure ? or do you mean cfg_agent_login ? check cfg_login_info table - it links persons to agent_logins.
[/quote]
« Last Edit: February 28, 2011, 12:26:01 PM by Tony Tillyer »

Offline bandorka

  • Full Member
  • ***
  • Posts: 120
  • Karma: 1
Re: cfg database question...
« Reply #3 on: February 28, 2011, 12:25:53 PM »
Hi,

It should be work:

SELECT p.dbid, p.user_name, p.last_name, p.first_name, l.login_code
FROM        cfg_person p LEFT OUTER JOIN
                      cfg_login_info i ON p.dbid = i.person_dbid LEFT OUTER JOIN
                      cfg_agent_login l ON i.agent_login_dbid = l.dbid

BR,
bandorka

Offline bandorka

  • Full Member
  • ***
  • Posts: 120
  • Karma: 1
Re: cfg database question...
« Reply #4 on: February 28, 2011, 12:30:18 PM »
Or a more complex one:

SELECT
DISTINCT p.dbid, p.user_name, p.last_name, p.first_name,
l.login_code,
CASE WHEN p.state = 2 THEN 'disabled' ELSE '' END AS status,
s.name FROM
cfg_person AS p
LEFT OUTER JOIN cfg_login_info AS i ON p.dbid = i.person_dbid
LEFT OUTER JOIN cfg_agent_login AS l ON i.agent_login_dbid = l.dbid
LEFT OUTER JOIN cfg_switch AS s ON l.switch_dbid = s.dbid
WHERE (p.is_agent = 2) AND (i.agent_login_dbid IS NOT NULL)

BR,
Bandorka

Marked as best answer by on Today at 05:59:42 AM

tony

  • Guest
Re: cfg database question...
« Reply #5 on: February 28, 2011, 02:52:45 PM »
  • Undo Best Answer
  • Thank you - I will try them out now... :)

    tony

    • Guest
    Re: cfg database question...
    « Reply #6 on: February 28, 2011, 05:28:11 PM »
    Not exactly the same but had to apply it in Hyperion, after telling it that non-fully-joined queries were ok(!).  Came up with this from the Hyperion SQL Output;

    [color=blue]SELECT AL4.dbid, AL4.user_name, AL4.last_name, AL4.first_name, AL2.login_code, AL3.name
    FROM dbo.cfg_login_info AL1 FULL OUTER JOIN dbo.cfg_person AL4 ON (AL1.person_dbid=AL4.dbid) FULL OUTER JOIN dbo.cfg_agent_login AL2 ON (AL1.agent_login_dbid=AL2.dbid) FULL OUTER JOIN dbo.cfg_switch AL3 ON (AL2.switch_dbid=AL3.dbid)
    WHERE (AL4.is_agent=2 AND (NOT AL1.agent_login_dbid IS NULL))[/color]

    It seems to have worked, since I now only have 188 entries...  :)

    Thanks!

    TT