1)access password from 3 (student,teacher,alumni)tables if given mail id matches to their mail id

2) i want to write only one program for password recovery for these three users

the code for accessing one password from one table is

```
 select password from current_student where mail_Id='"+mail_Id+"'

```

another code 

```
(SELECT PASSWORD AS r_password,mail_Id AS r_mail_Id  FROM current_student HAVING mail_Id = 'mahender0791@gmail.com') UNION (SELECT PASSWORD AS r_password,mail_Id AS r_mail_Id  FROM dept_Staff HAVING mail_Id = 'mahender0791@gmail.com') UNION (SELECT PASSWORD AS r_password,mail_Id AS r_mail_Id  FROM  alumni HAVING mail_Id = 'mahender0791@gmail.com') 

```

and the error message is

```
Query: (select password as r_password,mail_Id as r_mail_Id from current_student HAVING mail_Id = 'mahender0791@gmail.com') UNION (selec...

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HAVING mail_Id = 'mahender0791@gmail.com') 
 LIMIT 0, 1000' at line 1

```