I have a table with several columns, the two relevant columns for what I need to do are invoiceNumber and stockNumber. The scenario here is that it's a table of invoice information, so each invoice can have and will most likely have multiple rows in the table which represent each line item sold on the invoice.
I need to pick out only the invoices that have a stockNumber that begins with the letters "CC". The "CC" items are an extended warranty that was sold.
So in other words I need to get all the rows for invoices in the table that have a "CC" stockNumber so that I can do some further manipulation of those invoices.
An example of the rows for an invoice that has a "CC" stockNumber in one of the rows might be like this:
invoiceNumber invoiceDate customerNumber stockNumber soldQty soldPrice
------------- ----------- -------------- ----------- ------- ---------
489670 2013-04-11 25116 LR76003-34 1 899.99
489670 2013-04-11 25116 LR76003-08 1 0.00
489670 2013-04-11 25116 CCCOMBO 1 99.99
I would need to get all those rows.
An example of the rows for an invoice that does not have a "CC" stockNumber in any of the rows might be like this:
invoiceNumber invoiceDate customerNumber stockNumber soldQty soldPrice
------------- ----------- -------------- ----------- ------- ---------
4934170 2013-04-11 30738 OCT477-8 1 359.99
4934170 2013-04-11 30738 OCT477-6 1 116.99
I would need to completely skip these rows since none of the rows have a "CC" stockNumber.
I hope I'm making sense with this, thanks for any suggestions.