Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Sql filter Get the count of invoice details based on specific criteria

$
0
0

Glasses Database

Gucci Premier

Gucci High Quality lenses

Gucci Pink

Gucci Maroon

Gucci Blue

Rimless Red

Rimless Orange

Rimless Green

Rimless Blue

Rimless Purple

Visual Full Rim

Visual Half Rim

Visual Rimless

Visual Black

Visual Brown

Visual Silver

Optical Gold

Optical Non Glare

Optical Sunglasses

Optical Supreme

Optical Boys

Optical Girls

Sight Round

Sight Square

Sight Rimless

Sight Red

Sight Pink

Sight Silver

Sight Purple

Invoice Details

CUSTOMER

ITEM

AMOUNT

DATE

123

Sight Square

2

1/2/2014

123

Gucci Premier

1

1/2/2014

234

Visual Rimless

1

1/7/2014

234

Optical Boys

1

1/7/2014

234

Optical Girls

1

1/7/2014

234

Rimless Green

1

1/7/2014

656

Sight Purple

3

1/10/2014

789

Visual Brown

1

1/11/2014

789

Optical Sunglasses

3

1/11/2014

102

Rimless Orange

5

1/11/2014

489

Visual Full Rim

1

1/12/2014

598

Sight Silver

1

1/13/2014

598

Gucci Blue

1

1/13/2014

598

Rimless Red

1

1/13/2014

598

Optical Supreme

1

1/13/2014


I need the count of all sales for the month of January based on the type for example a count of all glasses sold that have the name Gucci in it and a count of all glasses that have the word visual in it and a count of all glasses that start with the word Rimless…

I want the end result to be

Gucci 2

Rimless 7

Visual 3

Optical 6

Sight 6

How would I be able to do this?


Debra has a question


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>