Recent Web Log Entries By Ben Nadel

Showing 1 - 15 of 100   < Prev | Next >

Performance Of LEFT OUTER JOIN Insert vs. INNER JOIN Delete Statement

Posted: August 19, 2011 at 10:06 AM by Ben Nadel

Tags: SQL

When it comes to database queries, the only kind of JOIN that I like to perform with SQL is an INNER JOIN. They are wicked fast and always satisfying. Any time that I have to figure out which records don't have relationships, it means that I have to do a LEFT OUTER JOIN; this is always depressing and often slow and I try to avoid it as much as pos... read more »

Comments (30)  |  Post Comment  |  Ask Ben  |  Permalink



Using MySQL's TO_DAYS() Function To Group Same-Day Events

Posted: July 12, 2011 at 10:24 AM by Ben Nadel

Tags: ColdFusion, SQL

The other day, I was creating a reporting and statistics page for a small project. One of the reports that I had to generate required me to group records by Date, outputting the number of records created on each day. The records themselves had a dateCreated field containing a date/time value. Due to the time portion of the date/time value, however... read more »

Comments (13)  |  Post Comment  |  Ask Ben  |  Permalink


Converting An IP Address To An Integer Using MySQL (Thanks Julian Halliwell)

Posted: January 29, 2010 at 8:30 AM by Ben Nadel

Tags: ColdFusion, SQL

The other day, as an exercise in bit-manipulation, I tried using bit shifting to convert IP address values to integer numbers . In the comments to that blog, Julian Halliwell mentioned that MySQL has built-in functions for performing these conversions. I had never heard of these functions before, so I thought I would do a little playing. In the... read more »

Comments (23)  |  Post Comment  |  Ask Ben  |  Permalink



Why My Queries Hate Application Service Layers

Posted: June 18, 2009 at 10:02 AM by Ben Nadel

Tags: ColdFusion, SQL

Last week, I was trying to take an old, procedural style ColdFusion application and factor out queries into some sort of Service layer. I wasn't trying to create an Object Oriented ColdFusion application - I was merely trying to centralize some business logic such that it wasn't so distributed throughout the application. At a glance, this seems li... read more »

Comments (63)  |  Post Comment  |  Ask Ben  |  Permalink


Ask Ben: Pulling Unique SQL Records That Match ALL Join Conditions

Posted: April 23, 2009 at 10:00 AM by Ben Nadel

Tags: Ask Ben, ColdFusion, SQL

The reader question is far too long to put here, but the jist of it was that the reader had a primary table that joined to several "property" tables in a One-to-Many kind of relationship. These properties could be selected in a search form and the reader wanted to be able to return all primary table records that matched at least every selected pro... read more »

Comments (15)  |  Post Comment  |  Ask Ben  |  Permalink


MySQL 3/4 - com.mysql.jdbc.Driver And allowMultiQueries=true

Posted: March 25, 2009 at 4:20 PM by Ben Nadel

Tags: ColdFusion, SQL

Just a quick note on configuring a MySQL JDBC Driver to allow multiple queries per CFQuery tag when using MySQL 3/4 (pre MySQL 5) on a ColdFusion 8 server. A few months ago, I leaned that you could add "allowMultiQueries=true" to the MySQL 5 connection string . However, today, I had to do some work on a ColdFusion MX 7 box that only had MySQL JDB... read more »

Comments (23)  |  Post Comment  |  Ask Ben  |  Permalink


Data Truncation: Truncated Incorrect DOUBLE Value When Updating Timestamp

Posted: February 18, 2009 at 3:04 PM by Ben Nadel

Tags: ColdFusion, SQL

I just spent the last hour trying to debug the smallest SQL problem! I have a datatable of Contracts and I was building a feature in our client software where we could end all contracts of a certain type (SLA) at the same time (trust me, there is a business reason behind this). To do this, I was executing the following MySQL Cross-Table UPDATE sta... read more »

Comments (51)  |  Post Comment  |  Ask Ben  |  Permalink


Seeding SQL RAND() Method With NEWID() For Per-Row Random Values (Thanks Joshua Cyr)

Posted: January 27, 2009 at 2:54 PM by Ben Nadel

Tags: SQL

From what I have read and from what I've seen demos of, I thought that MS SQL's RAND() method could only return one random value per connection. As I never looked at the documentation for RAND(), I never realized that it could be seeded. This morning, in my post on selecting random records from a weighted data table , Joshua Cyr pointed me to a... read more »

Comments (5)  |  Post Comment  |  Ask Ben  |  Permalink


Ask Ben: Selecting A Random Row From A Weighted, Filtered Record Set

Posted: January 27, 2009 at 9:56 AM by Ben Nadel

Tags: Ask Ben, ColdFusion, SQL

This is the scenario to help explain my question so I hope it makes sense: On a form is a zip code search box where you enter a zip code to see the list of services or shops in your area (e.g. 90210). The query returns 10 businesses in that area. Now, the tricky part is that some of the business should appear at the top (or near the top) more ofte... read more »

Comments (30)  |  Post Comment  |  Ask Ben  |  Permalink


MySQL Cannot Convert Value '0000-00-00 00:00:00' From Column XX To TIMESTAMP

Posted: December 19, 2008 at 4:15 PM by Ben Nadel

Tags: ColdFusion, SQL

When I first started using the MySQL database engine, I would get this error from time to time after doing data transfer: MySQL Cannot Convert Value '0000-00-00 00:00:00' From Column XX To TIMESTAMP For a long time, I just assumed that I was messing something up in the data transfer (which I may very well have been doing). But then, I got it aga... read more »

Comments (17)  |  Post Comment  |  Ask Ben  |  Permalink


MySQL: The Multi-part Identifier "u.id" Could Not Be Bound

Posted: December 18, 2008 at 9:19 AM by Ben Nadel

Tags: SQL

I had never seen this error before, so I thought I would just take a second to post it in case anyone tries to Google it. Luckily, my query was extremely small and so the error was obvious from a quick review of the SQL; but, in a large query this might not be readily apparent. Here's the kind of query I was running in MySQL: UPDATE [user] SE... read more »

Comments (8)  |  Post Comment  |  Ask Ben  |  Permalink


Getting ColdFusion To Work With MS SQL Server Express 2005 Databases

Posted: December 10, 2008 at 9:38 AM by Ben Nadel

Tags: SQL, Work

Yesterday, after debating about whether or not to convert my blog to MySQL so that I could have a version of it running locally, I was persuaded by my esteemed Twitter colleagues to try using MS SQL Server Express since I do have SQL Server 2005 running in production. Downloading and installing SQL Server Express took the better part yesterday w... read more »

Comments (30)  |  Post Comment  |  Ask Ben  |  Permalink


Both MySQL and MS SQL Server Use @@Identity To Report Latest Auto-Incrementing Value

Posted: December 9, 2008 at 10:14 AM by Ben Nadel

Tags: SQL

ahixon2112 on Twitter just rocked my world! I was talking about converting from MS SQL Server to MySQL and theorized that one of the only things I would have to change is my use of @@Identity to get the most recently created auto-ID value. I thought that I would have to convert all those @@Identity statements into LAST_INSERT_ID() statements. Bu... read more »

Comments (30)  |  Post Comment  |  Ask Ben  |  Permalink


Exploring The Cardinality And Selectivity Of SQL Conditions

Posted: December 8, 2008 at 3:14 PM by Ben Nadel

Tags: SQL

After posting Rick Osborne 's comments about Selectivity in a SQL, I thought I would take my lunch break to sort of wrap my head around the concept a little bit more fully. After some Googling, I came across a good comment on Experts Exchange : the selectivity is what goes with the cardinality concept. the "cardinality" refers to the number of ... read more »

Comments (11)  |  Post Comment  |  Ask Ben  |  Permalink


Rick Osborne On Database Indexing And SQL Best Practices

Posted: December 8, 2008 at 9:01 AM by Ben Nadel

Tags: SQL

Over Thanksgiving, I wrote a blog post on the importance of database performance in data-driven applications . I had stated that since the database calls were most often the bottleneck in an application, it is absolutely essential that I, as a software developer, have really good SQL skills. I vented that I don't know nearly enough about database... read more »

Comments (9)  |  Post Comment  |  Ask Ben  |  Permalink

Showing 1 - 15 of 100   Pages: 1 2 3 4 5 6 7 < Prev | Next >

View All Blog Entries »

  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 20, 2013 at 4:38 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, Your confusion is well founded, since this is a very confusing features. In fact, it ONLY works if you use array notation. Meaning, that this: arrayToList( query[ "columnName" ] ) ... read »
May 20, 2013 at 4:34 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I was thinking chicken and the egg, I wouldn't have expected it to work in the valuelist going in I guess. Maybe I just need a beer, long day :) ... read »
May 20, 2013 at 4:29 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, That's if you're trying to reference a specific row. In this case, we're trying to reference the entire query column as one cohesive value. So, you are correct that if you wanted to output a ... read »
May 20, 2013 at 4:24 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I thought when you used array notation to reference queries you always had to have the row or it would throw a similar error as well? ... read »
May 20, 2013 at 11:45 AM
Using jQuery's Animate() Step Callback Function To Create Custom Animations
This is really useful. I found out that you don't actually have to use a dummy css property (surprisingly). To animate a property in a linear-gradient for instance I did this this.css('someLinearGra ... read »
May 20, 2013 at 10:51 AM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Josh, Oh snap! You're totally right! I'm not sure I've ever tried that. I did know that you can call a number of other array-methods on ColdFusion query columns: http://www.bennadel.com/blog/167 ... read »
May 20, 2013 at 10:45 AM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Ben - I believe you can achieve the same functionality with ColdFusion's built in ArrayToList() function. ArrayToList( users[ "id" ] ); ... read »
May 20, 2013 at 10:21 AM
My Experience With AngularJS - The Super-heroic JavaScript MVW Framework
Is there any error logging and handling framework in angularjs, if not then in what way I can do this. ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools