Note that there are some explanatory texts on larger screens.

plurals
  1. POcomplex data requirement
    primarykey
    data
    text
    <p>Here is my query:</p> <pre><code>select Views.VisitorID, Views.ViewID, Views.ViewDateTime, Views.VisitDate, Visits.Views, ProductID.Product, PageID.Page, hostID.host from Views left join Product on Views.ViewID = Product.ViewID left join ProductID on Product.ProductID = ProductID.ProductID left join host on Views.ViewID = host.ViewID left join hostID on host.hostID = hostID.hostID inner join PageID on Views.PageID = PageID.PageID inner join Visits on Views.VisitID = Visits.VisitID where Visits.Views &lt;= 50 and visits.firstvisit = 1 and visitdate = '07 March, 2011' and ProductID.Product in ( 'product a', 'product b' ) group by Views.VisitorID, Views.ViewID, Views.ViewDateTime, Views.VisitDate, Visits.Views, ProductID.Product, PageID.Page, hostID.host order by Views.VisitorID,Views.ViewID, Views.ViewDateTime </code></pre> <p>I am looking for the above records for every visitorID when the very first viewID (there are multiple viewID for each visitorID) is either 'product a' or 'product b'. Can someone help?</p> <p>Appended below is the data and the expected results are visitorid=1, 2 &amp; 7.</p> <pre><code>VisitorID ViewID ViewDateTime VisitDate Views Product Page host 1 5874194128 1/31/2011 0:00 31-Jan 1 A X Y 2 5874194131 1/31/2011 0:00 31-Jan 6 B X Y 2 5874209907 1/31/2011 0:08 31-Jan 6 B X Y 2 5874210697 1/31/2011 0:08 31-Jan 6 B X Y 2 5874213486 1/31/2011 0:10 31-Jan 6 B X Y 2 5874220373 1/31/2011 0:13 31-Jan 6 D X Y 2 5874223494 1/31/2011 0:14 31-Jan 6 D X Y 3 5874194139 1/31/2011 0:00 31-Jan 2 E X Y 3 5874227680 1/31/2011 0:16 31-Jan 2 A X Y 4 5874194149 1/31/2011 0:00 31-Jan 1 F X Y 4 6082113181 2/22/2011 4:39 22-Feb 1 B X Y 5 5874194150 1/31/2011 0:00 31-Jan 1 F X Y 5 5909359616 2/3/2011 8:35 3-Feb 1 A X Y 5 6042085229 2/17/2011 23:59 17-Feb 2 A X Y 5 6042086534 2/17/2011 23:59 17-Feb 2 A X Y 6 5874194154 1/31/2011 0:00 31-Jan 1 D X Y 6 5936833964 2/6/2011 2:37 6-Feb 1 A X Y 6 5959528921 2/9/2011 0:33 9-Feb 1 B X Y 7 5874194157 1/31/2011 0:00 31-Jan 1 A X Y 7 5937521299 2/6/2011 20:58 6-Feb 4 C X Y 7 5937542326 2/6/2011 21:20 6-Feb 4 C X Y 7 5937542560 2/6/2011 21:20 6-Feb 4 C X Y 7 5937552378 2/6/2011 21:31 6-Feb 4 C X Y </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload