Wait! There are JOINS in PowerShell???

And no I’m not talking about -join

Words: 278

Time to read: ~1.5 minute

Update: 2018-03-22 – Had the wrong link to Warren’s post on Join-Object; Added more examples on request.

Update: 2018-03-23 – Code and screenshot for LEFT JOIN was actually for FULL OUTER JOIN. Updated

This is probably going to be the shortest blog post that I write, mainly because it’s a link to another persons blog, but I found this so interesting that I felt I had to share it.

Now we all know that PowerShell has joins but, in this context, I’d call them simple joins

Which gives us the lovely result of…

SimpleJoin
Simples, no?

That’s not what I’m talking about though!

What I’m talking about has even been talked about by the Microsoft PowerShell Team and what I’m talking about is Join-Object

Now I’m going to stop right here and just direct you to the blog post by Warren Frame ( blog | twitter ) where he talks all about it, why he wrote it, and how to use it.

I’ll leave you…

…with a quick example

LEFT JOIN

LeftJoinExample

the other option was Sir Mix-a-Lot

INNER JOIN

InnerJoinExample
No moving allowed

FULL OUTER JOIN

FullOuterJoinExample
Ice, Ice, Baby!

Now don’t get me wrong…

…if there is enough data to import this into the database & use T-SQL then you can bet that’s what I’m going to do! It’s what it was designed for, I’d find it easier, and it’s probably going to be faster after you hit a certain threshold.

However, if it’s small sets and the effort of importing the data is going to slow you down and break your flow…

Well, that doesn’t have to be the case anymore.

Amazing what you can do with PowerShell 🙂

Author: Shane O'Neill

DBA, T-SQL and PowerShell admirer, Food, Coffee, Whiskey (not necessarily in that order)...

2 thoughts on “Wait! There are JOINS in PowerShell???”

What's your opinion?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s