我正在编写一个程序来显示产品及其所在的商店。
到目前为止,我已经能够编写一个显示数据的 SQL 查询,如下所示:
Product Availability
Milk Store1
Candy Store1
Eggs Store1
Milk Store2
Eggs Store2
Candy Store3
Eggs Store3
是否有任何 SQL 查询可用于将产品分组到 Product 列,并将它们所在的商店扩展为 3 列,如下图所示?
Product Store1 Store2 Store3
Milk Yes Yes No
Candy Yes No Yes
Eggs Yes Yes Yes