The concept of 'loop' doesn't really apply to SQL. All the rows in a query are operated on as a
set in its entirety. That is, the query operates as if all the rows are operated on simultaneously and all at once. Now obviously it doesn't really do that, but it is helpful to think of query operations this way.
The SQL Server programming language T-SQL does implement a looping construct via the WHILE statement (or, ick, a GOTO statement). The statements within the scope of a WHILE loop are other T-SQL statements or entire queries, though - so see above.
If you want to operate on the rows of a query one row at a time, you can do so by using a cursor. Cursors have their place, but they are almost never needed, as they are slow and are resource hogs, and a far (i.e. order of magnitude) more effcient set-based solution almost always exists, although it can sometimes be hard to find...
What exactly do you want to happen when your 'hdwCat2' column is null? It appears that this named column appears in both the 'tblHdwInventory' table and the 'tblHdwCat2' table. Can it be NULL in both tables? What does it mean for this column to have a NULL value in either or both tables? What do you mean by 'separate select'? What exact error message are you getting?
Perhaps if you explained exactly what you are trying to do, and give some insight into your table structures, we can help...
P.S. I see you have described your structures in another post. See my comments there regarding your JOIN question, but my other questions above still stand.
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com