I am trying to create an Access query to count all the distinct transactions that don´t contain the characters (V). My data looks like this:
Transaction Number
997
997
998
998
998
999
999(V)
The final result I would like to get is “2” (997 and 998), so I can eliminate the 2 records ( 999 and 999(V) ). I was thinking in counting all rows and then substract all rows that contain (V), but can´t select the (V)´s. This is the query I have and It gives me 0 all the time and not 1:
SELECT COUNT(*) AS C
FROM (SELECT DISTINCT [Transaction Number]
FROM [Product History]
WHERE ([Transaction Date] = #7/6/2011#) AND ([Transaction Number] LIKE '*V*')) T
Any help is appreciated!
Thanks
There are a couple of ways to do this. I chose to use
LEFT JOIN / IS NULLyou could also doNOT INorNOT EXISTSthe key is joining
ph1.[Transaction Number] & '(V)' = ph2.[Transaction Number]which outputs