JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases
JET SQL nesting & aliases JET SQL nesting & aliases
JET SQL nesting & aliases
Go Back  Xtreme Visual Basic Talk > > > JET SQL nesting & aliases


Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2016, 10:26 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 59
Default JET SQL nesting & aliases


Hi,
I have an Access database of Employees.

The Employees are stored in a table called tblEmployee and information about them in another table call tblLog.

There are 3 levels
E = employee basic level
T = team leader which manages employees
M = manager which manages team leaders

The assignment is done by referring to another employee's id in the Manager field of the Employee table.

A Team Leader can pull information about the Employees they manage by querying those employees who have their ID in the Manager field.
I've got this working as follows.
Code:
"SELECT * FROM tblLog LEFT JOIN tblEmployee ON tblEmployee.[ID] = tblLog.[Employee ID] WHERE [Employee ID] IN (SELECT [ID] FROM tblEmployee WHERE [Manager] = " & lThisUserID & ")"
The Managers need to pull information on the Team Leaders who have their ID in the Manager field, plus all the Employees that have that Team Leader's ID in their Manager field. This is where I'm getting stuck.

I'm thinking along the lines of:
1) getting the ID's of those people who have the user as a manager into an alias.
Code:
"SELECT [ID] FROM tblEmployee WHERE [Manager] = " & lThisUserID as MyResult
2) getting from tblInfo the record where the Employee ID is in myResult or where the Manager is lThisUserID
Any help much appreciated.
Reply With Quote
Reply

Tags
manager, employees, team, tblemployee, field, information, employee, lthisuserid, leaders, table, select, leader, manages, pull, myresult, id], [manager], tbllog, [id], managers, tbllog.[employee, [employee, thinking, record, tblinfo


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases JET SQL nesting & aliases
JET SQL nesting & aliases
JET SQL nesting & aliases
 
JET SQL nesting & aliases
JET SQL nesting & aliases
 
-->