June 30, 2008 at 11:24 am
I'm something of a newb when it comes to SQL so this might be an obvious question but I have to ask regardless. I've created two temporary tables with 1 column each. I'm trying to combine these two columns but I need to retain the multiple instances of each item. The point of the query is to find items that are only showing in one of the tables with the following:
select RTRIM(batch1) AS DEADENDED
from #deadendedmed
group by batch1
having count(*) = 1
I've been using a Union all but it's eliminating the multiple instances which makes the above return all rows....any ideas?
June 30, 2008 at 11:37 am
Your question is pretty unclear. You talk about two temp tables, but the query you have included only has a single temp table it it. You are also indicating that you want multiple rows of the same item, but you have a GROUP BY in the query - this will eliminate duplicates.
June 30, 2008 at 11:42 am
That was only a portion of the query. As I was getting ready to paste the whole thing I found a pretty simple mistake (newb remember) and it works now. Thanks though.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply