dna
dna

Reputation: 483

spooling specific records in file using Oracle query

I want to spool 2 records from and oracle data base on the basis of a condition. SO this means I have 1000 records with fields name, address, SIN no and language (english or french). I want to spool 2 records 1 english and 1 french. Is there any way to pick up 2 records at random in which one record is english language and one record is french record

Upvotes: 0

Views: 256

Answers (1)

cha
cha

Reputation: 10411

As simple as this one will do:

select rownum, lang, name from t where lang = 'french'
union all 
select rownum, lang, name from t where lang = 'english'
order by 1,2

SQL Fiddle

Upvotes: 1

Related Questions