Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to return specific rows that meets certain conditions
    primarykey
    data
    text
    <p>I am totally new in SQL. I was working on a query that should return specific rows only from a table. (see. example source table and desired output below). can somebody help me figure out this one? I've tried searching through related topics on iterating through rows but was unsuccessful to find the answer I sought. thanks.</p> <p>Sample table</p> <pre><code>Machine Station Defect Code CreateTime 1 LU f1 8/20/2013 7:07 1 LU f2 8/20/2013 7:07 1 SLC d1 8/20/2013 7:08 1 SLC d2 8/20/2013 7:09 1 SLC d3 8/20/2013 7:10 1 SLC d1 8/20/2013 7:10 1 SLC d2 8/20/2013 7:11 1 SLC d1 8/20/2013 7:17 1 SLC d1 8/20/2013 7:20 1 UL f3 8/20/2013 7:26 1 UL f4 8/20/2013 7:26 1 UL f3 8/20/2013 7:26 1 UL f4 8/20/2013 7:26 2 LU f2 8/20/2013 7:29 2 SLC d1 8/20/2013 7:31 2 SLC d1 8/20/2013 7:38 2 SLC d2 8/20/2013 7:38 2 SLC d3 8/20/2013 7:39 2 SLC d2 8/20/2013 7:39 2 SLC d4 8/20/2013 7:39 2 SLC d5 8/20/2013 7:42 2 SLC d1 8/20/2013 7:43 2 SLC d1 8/20/2013 7:52 2 SLC d1 8/20/2013 7:53 2 SLC d2 8/20/2013 7:53 2 SLC d2 8/20/2013 7:54 2 SLC d4 8/20/2013 7:55 2 SLC d5 8/20/2013 7:56 </code></pre> <p>Needed result:</p> <p>OCAP Triggered on Machine1. d1 multiple occurence </p> <pre><code>Machine Station Defect Code CreateTime 1 SLC d1 8/20/2013 7:08 1 SLC d1 8/20/2013 7:10 1 SLC d1 8/20/2013 7:17 1 SLC d1 8/20/2013 7:20 </code></pre> <p>OCAP Triggered on Machine1. d1 consecutive occurence </p> <pre><code>Machine Station Defect Code CreateTime 1 SLC d1 8/20/2013 7:17 1 SLC d1 8/20/2013 7:20 </code></pre> <p>OCAP Triggered on Machine 2. d1 consecutive occurence </p> <pre><code>Machine Station Defect Code CreateTime 2 SLC d1 8/20/2013 7:31 2 SLC d1 8/20/2013 7:38 </code></pre> <p>OCAP Triggered on Machine 2. d2 multiple occurence </p> <pre><code>Machine Station Defect Code CreateTime 2 SLC d2 8/20/2013 7:38 2 SLC d2 8/20/2013 7:39 2 SLC d2 8/20/2013 7:53 </code></pre>
    singulars
    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