ok, in the two queries below, the salesOrderDetailId and the productId are
different for each.
the only thing in common is that they have the same companyIDNumber.
however since that's
not in the where clause, how can this return that both have a count of 1,
where I know that
the only one that has a count of one, for real, is the top one?

select
count(ipAddressNumber) as vehicles
from vehicleTable v
inner join companyTable c on c.companyIdNumber = v.companyIdNumber
inner join account a on a.accountId = c.crmGUID
inner join salesOrder so on a.accountId = so.accountId
inner join salesOrderDetail sod on sod.salesOrderId = so.salesOrderId

inner join product p on p.productId = sod.ProductId
where (sod.salesOrderDetailId = 'b25513c8-22e3-405e-9b2a-917c606e5149'
and p.productId = '9829daef-84ce-4248-9696-fa6686411b94')

select
count(ipAddressNumber) as vehicles
from vehicleTable v
inner join companyTable c on c.companyIdNumber = v.companyIdNumber
inner join account a on a.accountId = c.crmGUID
inner join salesOrder so on a.accountId = so.accountId
inner join salesOrderDetail sod on sod.salesOrderId = so.salesOrderId

inner join product p on p.productId = sod.ProductId
where (sod.salesOrderDetailId = '0568f951-29ef-4881-a786-d50e0d75e3f1'
and p.productId = 'e08c80b4-fd57-482e-93b9-213aef2ba83d')

cheers!

...tony

tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to