SQL Server Performance

What type of query is this?

Discussion in 'General Developer Questions' started by i_am_elan, Aug 7, 2007.

  1. i_am_elan New Member

    I am a newbie so please do not be so harsh. I am a pretty good at SQL but I want to get better. What type of query is this? (I know it contains a subquery because of the left join). Thanks in advance.
    select site.site_name, company_m.company_name, hrs.employee_hrs
    from OSHA_SITE_MASTER site
    inner join OSHA_COMPANY_MASTER company_m
    on site.company_id = company_m.company_id
    left join
    select employee_hrs, statmaster.site_id, begin_date_range
    from OSHA_STATISTICS_MASTER statmaster
    inner join OSHA_STATISTICS_DETAIL stat_detail
    on stat_detail.statistic_master_id = statmaster.statistic_master_id
    inner join osha_date_ranges as osha_date
    on osha_date.date_range_id = statmaster.date_range_id
    where osha_date.begin_date_range = '1/1/2007'
    ) as hrs
    on hrs.site_id = site.site_id
    where company_m.company_id = 11
  2. FrankKalis Moderator

    No, it isn't using a subquery, but rather using a derived table on the right side of the left join.
  3. satya Moderator

    Left join used with a derived table results, but why do you need such information anyway?
  4. i_am_elan New Member

    Thanks Guys. I needed to know so if i am looking for help on queries like this, I will know how to search for them.

Share This Page