﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Count / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 22:02:40 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Count</title><link>http://www.sqlservercentral.com/Forums/Topic436307-338-1.aspx</link><description>Happy new year!</description><pubDate>Wed, 26 Dec 2007 03:14:21 GMT</pubDate><dc:creator>jacob sebastian</dc:creator></item><item><title>RE: Count</title><link>http://www.sqlservercentral.com/Forums/Topic436307-338-1.aspx</link><description>I don't know How to Thank You. That Did the Trick. Thanks a lot and I wish you a happy new Year</description><pubDate>Wed, 26 Dec 2007 03:11:24 GMT</pubDate><dc:creator>vblllove</dc:creator></item><item><title>RE: Count</title><link>http://www.sqlservercentral.com/Forums/Topic436307-338-1.aspx</link><description>Something like this?;WITH family1 AS (	SELECT DISTINCT InvoiceID 	FROM invoiceDetails	WHERE ItemCode LIKE 'PMM1%'), family2 AS (	SELECT DISTINCT InvoiceID 	FROM invoiceDetails	WHERE ItemCode LIKE 'PMM2%'), family3 AS (	SELECT DISTINCT InvoiceID 	FROM invoiceDetails	WHERE ItemCode LIKE 'PMM3%')SELECT SalesRepID, COUNT(*) FROM Invoices iINNER JOIN family1 f1 ON f1.invoiceID = i.InvoiceIDINNER JOIN family2 f2 ON f2.InvoiceID = i.InvoiceIDINNER JOIN family3 f3 ON f3.InvoiceID = i.InvoiceIDGROUP BY SalesRepID</description><pubDate>Wed, 26 Dec 2007 02:46:11 GMT</pubDate><dc:creator>jacob sebastian</dc:creator></item><item><title>Count</title><link>http://www.sqlservercentral.com/Forums/Topic436307-338-1.aspx</link><description>Hi,I m having problem in creating a query for counting Articles of a same FAmily in an Invoice: I have two Tables Invoice, InvoiceDetails that are related through InvoiceId.In Invoice Table I keep the Salesman Code. In InvoiceDetails I keep the Articles that they Sell ( Marlboro Family). The Marlboro Family is defines as three GRoups (Marlboro Light, Marlboro Ultra Light and Marlboro Full Flavour) . Their Code is like:PMM1112, PMM1212, PMM1313 (MArlboro Light)PMM2111, PMM2112, PMM2112 (Marlboro Full Flavour)PMM3111 (Marlboro Ultra Light)Now I have to count the Invoices for Each Salesman that have an Invoice that Include all Three of them in one InvoiceE.c InvoiceId 00001 (PMM1112, PMM1212, PMM2111, PMM3111).Thanks in Advance</description><pubDate>Wed, 26 Dec 2007 02:31:38 GMT</pubDate><dc:creator>vblllove</dc:creator></item></channel></rss>