- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Oracle table joins
Operating System - HP-UX
1753720
Members
4943
Online
108799
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2009 01:53 PM
тАО04-07-2009 01:53 PM
Oracle table joins
I am at a loss.
I need to list the users that have not logged in in 180 days.
I would like to print there manager as well, but manager is also in the same table.
SELECT USER.LOGON_ID, LOGON_SESSION.logged_off, m.LOGON_ID "Manager"
FROM USER, LOGON_SESSION, USER m, USER_ROLE
where USER.user_id = LOGON_SESSION.for_user
AND m.user_id = USER_ROLE.FOR_USER
AND USER_ROLE.ROLE = '2'
AND LOGON_SESSION.logged_off < sysdate -180
(this does not work it returns wrong data)
*************
2 is the Supervisor roll.
If I split into two separate sql, I can list all users that are managers.
select * from USER, USER_ROLE
where USER.user_id = USER_ROLE.FOR_USER
and USER_ROLE.ROLE = '2';
Then I can just get the users that have not logged in in 180 days.
SELECT USER.logon_id, LOGON_SESSION.logged_off
FROM USER, LOGON_SESSION
where USER.user_id = LOGON_SESSION.for_user
AND LOGON_SESSION.logged_off < sysdate -180
But how can I put both together...
I need to list the users that have not logged in in 180 days.
I would like to print there manager as well, but manager is also in the same table.
SELECT USER.LOGON_ID, LOGON_SESSION.logged_off, m.LOGON_ID "Manager"
FROM USER, LOGON_SESSION, USER m, USER_ROLE
where USER.user_id = LOGON_SESSION.for_user
AND m.user_id = USER_ROLE.FOR_USER
AND USER_ROLE.ROLE = '2'
AND LOGON_SESSION.logged_off < sysdate -180
(this does not work it returns wrong data)
*************
2 is the Supervisor roll.
If I split into two separate sql, I can list all users that are managers.
select * from USER, USER_ROLE
where USER.user_id = USER_ROLE.FOR_USER
and USER_ROLE.ROLE = '2';
Then I can just get the users that have not logged in in 180 days.
SELECT USER.logon_id, LOGON_SESSION.logged_off
FROM USER, LOGON_SESSION
where USER.user_id = LOGON_SESSION.for_user
AND LOGON_SESSION.logged_off < sysdate -180
But how can I put both together...
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-07-2009 10:12 PM
тАО04-07-2009 10:12 PM
Re: Oracle table joins
The way you layed-out your question it is hard to puzzle out as we can not reproduce it.
Here is an example on how to ask sql questions,
this is prob also a better forum for asking these type of Q.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4725668677832
good luck
Here is an example on how to ask sql questions,
this is prob also a better forum for asking these type of Q.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4725668677832
good luck
Look before you leap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2009 08:09 AM
тАО11-05-2009 08:09 AM
Re: Oracle table joins
appreciate your help
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP