Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users
It's poor code because running it as of 2013/12/31 will give me anniversaries for years not = 2013 and includes rows from 2014.
select cs.id as csid, csi.Search_Number as searchID, csi.date_of_placement as datePlaced, ui.firstname, ui.lastname, cp.name as companyname, cp.address_line_1, cp.address_line_2, cp.city, cp.state, cp.zip, cp2.name as currentcompanyname, cp2.address_line_1 as current_address_line_1, cp2.address_line_2 as current_address_line_2, cp2.city as current_city, cp2.state as current_state, cp2.zip as current_zip from client_searches_individuals as csi left join users_info as ui on ui.id = csi.individual_number left join client_searches as cs on cs.id = csi.search_number left join companies as Cp on cp.id = cs.company_number left join companies as cp2 on cp2.id = ui.current_company_number where 0=0 <!--- This is for the varchar date field, take away anything with the year selected ---> and csi.date_of_placement not like '#dateformat(attributes.startdate,'yyyy')#%' <cfif attributes.startdate neq ""> and right(csi.date_of_placement,5) >= '#dateformat(attributes.startdate,'mm/dd')#' </cfif> <cfif attributes.enddate neq ""> and right(csi.date_of_placement,5) <= '#dateformat(attributes.enddate,'mm/dd')#' </cfif> and isnull(cs.id,0) > 0 order by date_of_placement
where 0=0 and (DATEDIFF(year, cast(csi.date_of_placement as datetime), GETDATE() )) => 1 and isnull(cs.id,0) > 0 and isnull(date_of_placement,'') > ''
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.