mardi 29 mars 2016

How to select Multiple Rows based on one Column

So I have looked around the internet, and couldn't find anything that could be related to my issue.

This is part of my DB:

ID  |     English    |    Pun    |  SID   |  Writer   |
=======================================================
1   |      stuff     |   stuff   |   1    |   Full    |
2   |      stuff     |   stuff   |   1    |   Rec.    |
3   |      stuff     |   stuff   |   2    |   Full    |
4   |      stuff     |   stuff   |   2    |   Rec.    |

Now how would I get all rows with SID being equal to 1.

Like this

ID  |     English    |    Pun    |  SID   |  Writer   |
=======================================================
1   |      stuff     |   stuff   |   1    |   Full    |
2   |      stuff     |   stuff   |   1    |   Rec.    |

Or when I want to get all rows with SID being equal to 2.

ID  |     English    |    Pun    |  SID   |  Writer   |
=======================================================
3   |      stuff     |   stuff   |   2    |   Full    |
4   |      stuff     |   stuff   |   2    |   Rec.    |

This is my current SQL Query using SQLite:

SELECT * FROM `table` WHERE `SID` = `1`

And I only get the first row, how would I be able to get all of the rows?

Aucun commentaire:

Enregistrer un commentaire