Jump to content

set_relation based on other column value


  • Please log in to reply
No replies to this topic

#1 vissuviswanath



  • Members
  • Pip
  • 2 posts

Posted 19 March 2015 - 07:18 AM



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.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users