|
-
Feb 22nd, 2004, 11:21 PM
#1
Thread Starter
Frenzied Member
I need a little SQL help
Code:
SELECT distinct v.*,
[cUser].cEmail,
[oHRCurrent].ojSuperSSN as cSuperSSN,
[oHRCurrent].ojDivision as cDivision,
[oHRCurrent].ojDepartment as cDepartment
FROM [v_employee_list_names] v
JOIN [iMaster] ON v.[iKey]=[iMaster].[iKey]
JOIN [oHRBase] ON [iMaster].[iKey]=[oHRBase].[oKeyMaster]
JOIN [oHRCurrent] ON [oHRBase].[oKey]=[oHRCurrent].[oKeyBase]
JOIN [cUser] ON [iMaster].[iSSN]=[cUser].[cSSN] AND [cUser].[cKeyCompany]=v.[iKeyCompany]
WHERE v.[iKeyCompany]=1442
AND oHRCurrent.oPSID = 'FLX2'
AND v.[iKey] <> 0
ORDER BY v.[iName]
Can someone please explain what "v.*" means in the 1st line? Also what does the "v" mean in the FROM line?
[v_employee_list_names] is a view
this is for SQL Sever 2000
thanks
Dimava
NXSupport - Your one-stop source for computer help
-
Feb 23rd, 2004, 12:38 AM
#2
Addicted Member
Re: I need a little SQL help
Originally posted by dimava
Code:
SELECT distinct v.*,
[cUser].cEmail,
[oHRCurrent].ojSuperSSN as cSuperSSN,
[oHRCurrent].ojDivision as cDivision,
[oHRCurrent].ojDepartment as cDepartment
FROM [v_employee_list_names] v
JOIN [iMaster] ON v.[iKey]=[iMaster].[iKey]
JOIN [oHRBase] ON [iMaster].[iKey]=[oHRBase].[oKeyMaster]
JOIN [oHRCurrent] ON [oHRBase].[oKey]=[oHRCurrent].[oKeyBase]
JOIN [cUser] ON [iMaster].[iSSN]=[cUser].[cSSN] AND [cUser].[cKeyCompany]=v.[iKeyCompany]
WHERE v.[iKeyCompany]=1442
AND oHRCurrent.oPSID = 'FLX2'
AND v.[iKey] <> 0
ORDER BY v.[iName]
Can someone please explain what "v.*" means in the 1st line? Also what does the "v" mean in the FROM line?
[v_employee_list_names] is a view
this is for SQL Sever 2000
thanks
Dimava
"V" is the alias name of the object that has been specified in the FROM clause. Instead of using the long names for objects u can use there alias names.
The "v.*" in the first line means that the query maeans that all the columns in the object with alias name "v" and the alias name is specified in the FROM clause
Hope this is clarifying ur query. If not post here
Cute Member 
-
Feb 23rd, 2004, 04:33 AM
#3
Thread Starter
Frenzied Member
Re: Re: I need a little SQL help
Originally posted by cutamacious
"V" is the alias name of the object that has been specified in the FROM clause. Instead of using the long names for objects u can use there alias names.
The "v.*" in the first line means that the query maeans that all the columns in the object with alias name "v" and the alias name is specified in the FROM clause
Hope this is clarifying ur query. If not post here
so v is basically another name for that view?
NXSupport - Your one-stop source for computer help
-
Mar 10th, 2004, 03:38 AM
#4
Addicted Member
Re: Re: Re: I need a little SQL help
Originally posted by dimava
so v is basically another name for that view?
Yes, for accessing it using a simple name rather than a complicated name like one mentioned for the view, which may result in typing errors and hence may not execute
Cute Member 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|