tirenweb
tirenweb

Reputation: 31709

SQL clause: newbie question

I have this table:

culture   street
------------------------
es        Calle Roma 15
eu        Via Roma 15
es        Calle Paris 20
eu        Via Paris 20

Is possible to create an SQL query that retrieve first the rows that the value "es" (in the field culture of course) and the rows that the value "es"?

Upvotes: 1

Views: 103

Answers (4)

I am not sure whether you wanted something like this:

First of all, to retrieve the rows that has the value "es" in culture column, you need to write the following query -

SELECT * FROM SOMETABLE WHERE culture = "es"

Next, I am assuming you wanted to retrieve the rows that has the value "eu", you made a typo here. Same query -

SELECT * FROM SOMETABLE WHERE culture = "eu"

And please mention the table name whenever you are asking questions regarding SQL and SQL Query.

Upvotes: 0

Tim Mahy
Tim Mahy

Reputation: 1319

select * from tbl where culture = 'es' or culture = 'eu'
order by culture

should also do the trick :)

Upvotes: 2

Catfish
Catfish

Reputation: 19284

If your table only contains es and eu cultures you can just do an order by

select * from tbl
order by culture

Upvotes: 3

bla
bla

Reputation: 5480

There are many different ways to achieve this. One of it is to use UNION:

select * from tbl where culture = 'es'
UNION
select * from tbl where culture = 'eu'

Upvotes: 2

Related Questions