I have a table called "VisitDetails" which tracks pages viewed within a Visit.
Looks like this:
VisitID PageID CategoryID ProductID (all are int, VisitID FK to a table called Visits which hold data about the visitor)
A Visit consists of multiple page views - they may be Pages, Categories, or Products.
I am trying to figure out how many Visits have a ProductID in any rows. For example data:
VisitID PageID CategoryID ProductID
1 NULL NULL 100
2 1000 NULL NULL
1 1000 NULL NULL
1 NULL 10000 NULL
2 NULL NULL 101
My ideal results would show me that 100% (count 2 of 2 unique Visits had a ProductID). This will tell me what proportion of Visits viewed any Product.
Struggling to write an effective query to do this.