Category Archives: Code

Getting Averages by removing outliers

I had an interesting challenge this week. I needed to get average sales by product but the boss wants to eliminate the top 10% and bottom 10% so she can get a better picture of the actual sales values. We … Continue reading

Posted in Code, SQL | Comments Off on Getting Averages by removing outliers

CFSelect bind for Search or Edit on same form

Creating a data based derived dropdown list bound to a record for Search or Edit form is sometimes needed. For search you may want to return All as your first item in the dropdown, but for edit mode you likely … Continue reading

Posted in Code, Coldfusion, Snippets, SQL | Tagged , | Comments Off on CFSelect bind for Search or Edit on same form

Date Subtraction or Difference

Sometimes you need to know the differences between two dates in days months years whatever. SQL SERVER select datediff(day,date1, date2) as days_diff, datediff(month,date1, date2) as months_diff… Can also do year, quarter, week, hour, minute, and second dateparts. Dates can be … Continue reading

Posted in Code, Coldfusion, Javascript, JQuery, Snippets, SQL | Tagged | Comments Off on Date Subtraction or Difference

SQL using case to Identify blanks vs NULLs

I had a strange issue driving me nuts today. I had data with null values and could use isNull to capture most of them and assign a new value to the field. However about 10 records would not accept the … Continue reading

Posted in Code, Snippets, SQL | Tagged , , , | Comments Off on SQL using case to Identify blanks vs NULLs

Coldfusion Query of Queries to Join two datasets

I had an issue where I needed to join data from two different datasets with out having an ODBC connection created by the admin. I ran the two queries in thier respective databases then used query of queries to join … Continue reading

Posted in Code, Coldfusion, Snippets | Comments Off on Coldfusion Query of Queries to Join two datasets