mysql - database query possibility? -


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

2) want write 1 program password recovery these 3 users

the code accessing 1 password 1 table is

 select password current_student mail_id='"+mail_id+"' 

another code

(select password r_password,mail_id r_mail_id  current_student having mail_id = 'mahender0791@gmail.com') union (select password r_password,mail_id r_mail_id  dept_staff having mail_id = 'mahender0791@gmail.com') union (select password r_password,mail_id r_mail_id   alumni having mail_id = 'mahender0791@gmail.com')  

and error message is

query: (select password r_password,mail_id r_mail_id current_student having mail_id = 'mahender0791@gmail.com') union (selec...  error code: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'having mail_id = 'mahender0791@gmail.com')   limit 0, 1000' @ line 1 

could this:

(select password r_password,mail_id r_mail_id current_student having r_mail_id = 'mahender0791@gmail.com') union (select password r_password,mail_id r_mail_id dept_staff having r_mail_id = 'mahender0791@gmail.com') union (select password r_password,mail_id r_mail_id your_table_name having r_mail_id = 'mahender0791@gmail.com') 

your_table_name >> change table name respective table name.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -