⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

set_relation based on other column value



vissuviswanath

vissuviswanath
  • profile picture
  • Member

Posted 19 March 2015 - 07:18 AM

Hi,

 

I had 3 tables. Users,Admins,Vendors.

When  a user register 's it can be approved by either vendor or admin.

I am storing  the approved_type and approved_id who approved it in the Users Table.

For example if an Admin approves an user i am saving approved_type as A and his AdminID.

If a vendor approves  i am saving approved_type as V and his vendorID.

 

I would like to show the complete data of the Users table such as .

      Username     User email        Approved by    Approver name                registered date.

Ex: Shiva          shiva@test.com    Vendor           raghu(Vendor Name)        2015-03-04

 

Based upon the approved_type of each record i need to fetch the name of the approved person  either from Admin table or Vendor Table..

 

Can you please help me with some solution on this.