Results 1 to 4 of 4

Thread: I need a little SQL help

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    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

  2. #2
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185

    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

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    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

  4. #4
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185

    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
  •  



Click Here to Expand Forum to Full Width