Note that there are some explanatory texts on larger screens.

plurals
  1. POselect distinct pair of values from sqlite database
    text
    copied!<p>I have a sqlite database that has a table structure as follows</p> <p>column 1: source ip <br>column 2: source port <br>column 3: destination ip <br>column 4: destination port <br>column 5: protocol <br>column 6: type <br></p> <p>snapshot of the table looks like this</p> <pre>╔═══╦══════╦═══╦═════╦═════╦═══╗ ║ A ║ 444 ║ B ║ 555 ║ TCP ║ 2 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ B ║ 555 ║ A ║ 444 ║ TCP ║ 1 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ C ║ 100 ║ A ║ 5525║ UDP ║ 1 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ B ║ 5222 ║ C ║ 2552║ TCP ║ 2 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ A ║ 5525 ║ C ║ 100 ║ UDP ║ 2 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ C ║ 2552 ║ B ║ 5222║ TCP ║ 1 ║ ╚═══╩══════╩═══╩═════╩═════╩═══╝ </pre> <p>In the above table you can see that there is entry for both (A,444) , (B,555) and (B,555), (A,444). I want to select the distinct [(source ip,source port), (destination ip,destination port), (protocol)] i.e., i want a query that gives a output as follows</p> <pre>╔═══╦══════╦═══╦═════╦═════╦═══╗ ║ A ║ 444 ║ B ║ 555 ║ TCP ║ 2 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ B ║ 5222 ║ C ║ 2552║ TCP ║ 2 ║ ╠═══╬══════╬═══╬═════╬═════╬═══╣ ║ C ║ 100 ║ A ║ 5525║ UDP ║ 1 ║ ╚═══╩══════╩═══╩═════╩═════╩═══╝ </pre> <p>Thanks in advance </p>
 

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