is running this command via ssh possible? (formatting issues)

Here is the command I want to run:

for pkg in `pkginfo | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq

It returns the package info in a form such as:

113210-03 VRTSfspro
112392-06 VRTSvmman
113596-03 VRTSvmpro
113206-10 VRTSvxfs

Thing is I want to run it over an ssh connection on remote servers, you would think at first it would look something like this:

ssh apollo "for pkg in `pkginfo" | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq

Problem is that due to all the " and ` in that statement things are getting confused and it doesn't run.

Anyone have any ideas on how to format that to get it to work? The stuff in between the " and the " gets run on the remote server but that ` before pkginfo is thowing it off, I think.

why dont you put your command in a script file on the remote server and just use ssh on your own server to run the script and ftp back the output?