How to make join select of two tables according to table1.id=table2.uid and at the same time table2.active='1'' in PHP/MySQL?
Is this possible in one query? 

I mean I have a 

**table1** with columns(**id,name,date**) where I have a couple of rows and 

**table2** with columns(**id,uid,active**) where **id** is autoincrement, **uid** is integer and can be the same in mulitple rows, so it is not unique. Column **active** is unique(is presented only once, in only one row, for one **uid**). So, you can have in this table 3 rows with uid equals 25, but from all these 3 rows only one have ative=1 others have active equals 0.

My question is how to write the select, where I want to get the only one row as a result. ***The row would be the one with active=1 and at the same time uid equals with id of the first table.***

Thanks in advance for any advice.

P.S. If it's possible to achieve that with Active Record in CodeIgniter, I will be really thankful for this possibility too.


How to make join select of two tables according to table1.id=table2.uid and at the same time table2.active='1'' in PHP/MySQL?
===

Is this possible in one query? 

I mean I have a 

**table1** with columns(**id,name,date**) where I have a couple of rows and 

**table2** with columns(**id,uid,active**) where **id** is autoincrement, **uid** is integer and can be the same in mulitple rows, so it is not unique. Column **active** is unique(is presented only once, in only one row, for one **uid**). So, you can have in this table 3 rows with uid equals 25, but from all these 3 rows only one have ative=1 others have active equals 0.

My question is how to write the select, where I want to get the only one row as a result. ***The row would be the one with active=1 and at the same time uid equals with id of the first table.***

Thanks in advance for any advice.

P.S. If it's possible to achieve that with Active Record in CodeIgniter, I will be really thankful for this possibility too.

