I have a user table in which i have three fields id,email,u\_firstname,u\_status
in which i have to apply searching on this table with case function in where condition.

```
users table structure
...........................................................................
id    email                       u_firstname    status(0=inactive,1=active)
...........................................................................
1     varunjoshi919@gmail.com      varun              1
2     abc@gmail.com                abc                0

```

I write the below query in which i have used case function of mysql
which works like that if 0 is come then inactive comes as a string or 
if 1 is come from db then active will show like this 

Query

```
SELECT `id`,`email`,`u_firstname`,case u_status when '0' then 'inactive' when '1' then 'active' end as status FROM `users` 

```

After running the above query i got this output
 from users table structure

```
...........................................................................
id    email                       u_firstname    status(0=inactive,1=active)
...........................................................................
1     varunjoshi919@gmail.com      varun              active
2     abc@gmail.com                abc                inactive

```

After this,i have to apply searching on this table suppose if i write
ac or any starting letter of user status then we will get the list of all the active users.

**I need this Output when i type ac on search box for active user record**

```
...........................................................................
    id    email                       u_firstname    status(0=inactive,1=active)
    ...........................................................................
    1     varunjoshi919@gmail.com      varun              active

```

I have tried the below query but it is not giving any record.

```
SELECT `id`,`email`,`u_firstname`,case u_status when '0' then 'inactive' when '1' then 'active' end as status FROM `users` where `u_status` like 'ac%' 

```