Q: Join two datasets on keys I want to be able to join two datasets by keys, pretty much like I'd do in SQL.  I thought the JoinAcross function might do it, but it doesn't operate the way I thought.  The example in the documentation shows:
JoinAcross[
{<|a -> 1, b -> X|>, <|a -> 2, b -> Y|>},
{<|a -> 1, c -> X|>, <|a -> 2, c -> Y|>}, Key[a]]

resulting in:
{<|a -> 1, b -> X, c -> X|>, <|a -> 2, b -> Y, c -> Y|>}

This joins down.  What I need is like the following:
JoinAcross[
{<|a -> 1, b -> X|>, <|a -> 1, c -> Y|>},
{<|a -> 2, b -> XX|>, <|a -> 2, c -> YY|>}, Key[a]]

To give me:
{<|a->1, b->X, c->Y|>, <|a->2, b->XX, c->YY|>}

That's what I expect from a SQL join.  Is there some way to do this with datasets, or should I go back to the "old way" of gathering things together?
Also, I really would like to do this by joining on 2 keys.  Not just Key[a], but something like {Key[a],Key[b]}.

A: Apologies if I misunderstand as I am not familiar with SQL but this seems to match your sole example:
i1 = {<|a -> 1, b -> X|>, <|a -> 1, c -> Y|>};
i2 = {<|a -> 2, b -> XX|>, <|a -> 2, c -> YY|>};

Join @@@ {i1, i2}


{<|a -> 1, b -> X, c -> Y|>, <|a -> 2, b -> XX, c -> YY|>}



A: I don't know how to make JoinAcross yield the result you ask for, but you can get it from Merge.
Merge[#, Union /* First] & /@ 
  {{<|a -> 1, b -> X|>, <|a -> 1, c -> Y|>}, {<|a -> 2, b -> XX|>, <|a -> 2, c -> YY|>}}


{<|a -> 1, b -> X, c -> Y|>, <|a -> 2, b -> XX, c -> YY|>}



A: The Join[]  is across two datasets and only two.  To make it easier to visualize I'll make the sets longer. With 2x2 it's easy to confuse up-down with left-right.
asc1 = {<|a -> 1, b -> X|>, <|a -> 2, b -> Y|>, <|a -> 4, b -> bb|>, <|
        a -> 8, b -> 3|>};
asc2 = {<|a -> 1, c -> X|>, <|a -> 4, c -> 44|>, <|a -> 9, c -> w|>, <|
    a -> 2, c -> Y|>};

Let's see the datasets
Column[asc1]




Column[asc2]




The JoinAcross
jasc = JoinAcross[asc1, asc2, Key[a]]
{<|a -> 1, b -> X, c -> X|>, <|a -> 4, b -> bb, c -> 44|>, <|a -> 2, 
  b -> Y, c -> Y|>}

Column[jasc]




It is an Inner Join with keys properly matched and unmatched keys dropped.  Merge would not respect the keys and unlike your example there's no assumption of 1-to-1 alignment on Key[a].

A: Currently in Mathematica v10 you need to be careful joining datasets as the Key[] function doesn't work with a string key for a dataset (it does for an association)  .  See Taliesin's comment below.  Personally I think the help is a bit misleading referring to SQL joins with associations when they are more like "joins" in a NOSQL database.  
Examples of joins both as datasets and associations :
(* define an association and related dataset *)

assocAnimal = {<|"key" -> 1, "Animal" -> "Dog"|>, <|"key" -> 2, "Animal" -> "Cat"|>}


{<|"key" -> 1, "Animal" -> "Dog"|>, <|"key" -> 2, "Animal" -> "Cat"|>}


dsAnimal = Dataset[assocAnimal]


(* define another dataset to join to *)

assocEats = {<|"key" -> 1, "Food" -> "Chum"|>, <|"key" -> 2,"Food" -> "Wiskas"|>}
dsEats = Dataset[assocEats]

(*SQL equivalent:
   select a.key,a.Animal,e.Eats
   from dsAnimal a
   inner join dsEats e
   on a.key = e.key
*)
    JoinAcross[assocAnimal, assocEats, Key["key"]] 


{<|"key" -> 1, "Animal" -> "Dog", "Food" -> "Chum"|>, <|"key" -> 2, "Animal" -> "Cat", "Food" -> "Wiskas"|>}


Dataset the resulting association
    Dataset[JoinAcross[assocAnimal, assocEats, Key["key"]]]


OR more directly
JoinAcross[dsAnimal, dsEats, "key"]  (*  note the lack of Key[]  *)

