我有表客户(id,name)电话(id,customerId,phoneType,phone)是否可以编写一个返回如下行的查询:
客户 ID、客户名称、电话 1、电话 2、移动 1、移动 2
Phone1,Phone2,Mobile1,Mobile2 是电话类型
我试过
select id as CustomerId, name as CustomerName, phone as Phone1
from Customers, Phones
where Customers.id = Phones.customerId and
Phones.phoneType = N'Phone1'