title: I need to know how to create a crosstab query
body: <p>I need help creating the below results.  I thought of a sql pivot but I don't know how to use it.  Looked at a few examples and cannot come up with a solution.  Any other ideas on how to accomplish this is also welcome. Status columns must be dynamically generated.</p>
  
  <p>Have three tables, assets, assettypes, assetstatus</p>
  
  <pre>
  Table: assets
  assetid     int
  assettag    varchar(25)
  assettype   int
  assetstatus int
  
  Table: assettypes
  id         int
  typename   varchar(20)  (ex: Desktop, Laptop, Server, etc.)
  
  Table: assetstatus
  id         int
  statusname varchar(20)  (ex: Deployed, Inventory, Shipped, etc.)
  </pre>
  
  <p>Desired results:</p>
  
  <pre>
  AssetType     Total   Deployed   Inventory  Shipped     ...
  -----------------------------------------------------------
  Desktop         100       75        20          5       ...
  Laptop           75       56        19          1       ...
  Server           60       50        10          0       ...
  </pre>
  
  <p>Some Data:</p>
  
  <pre>
  assets table:
  1,hol1234,1,1
  2,hol1233,1,2
  3,hol3421,2,3
  4,svr1234,3,1
  
  assettypes table:
  1,Desktop
  2,Laptop
  3,Server
  
  assetstatus table:
  1,Deployed
  2,Inventory
  3,Shipped
  </pre>