MySQL Forums
Forum List  »  Newbie

Need select query for eav modeling
Posted by: Harshad Goswami
Date: November 27, 2009 06:29PM

My project use EAV modeling

My table and output are as follows ,

INPUT TABLES

[1] customer_entry
----------------------------
cust_entity_id | email
----------------------------
1 | bidi@addon.com
2 | rav@addon.com
----------------------------



[2] eav_attribute_type
------------------------------------------
attribute_type_id | name
------------------------------------------
1 | customer
2 | customer_address
------------------------------------------


[3] eav_attribute
-----------------------------------------------------------
attribute_id | code | attribute_type_id
-----------------------------------------------------------
1 | speciality | 1
2 | small_image | 1
3 | city | 2
-----------------------------------------------------------

(Note :- eav_attribute.attribute_type_id refrence eav_attribute_type.attribute_type_id)


[4] customer_address_entry
---------------------------------------------------------------
add_entity_id |attribute_type_id | cust_entity_id
---------------------------------------------------------------
1 | 2 | 1
---------------------------------------------------------------

(Note :- customer_address_entry.attribute_type_id reference eav_attribute_type.attribute_type_id and
customer_address_entry.cust_entity_id reference customer_entry.cust_entity_id
)



[5] customer_address_entry_varchar
------------------------------------------------------------------------
v_id | attribute_type_id | attribute_id | add_entity_id | value
------------------------------------------------------------------------
1 | 2 | 3 | 1 | Ahmedabad
------------------------------------------------------------------------
(Note :- customer_address_entry_varchar.entity_id reference customer_address_entry.address_entity_id
customer_address_entry_varchar.attribute_type_id reference eav_attribute_type.attribute_type_id and
customer_address_entry_varchar.attribute_id reference eav_attribute.attribute_id


[6] customer_entry_varchar
------------------------------------------------------------------------------------------------------------------------
v_id | attribute_type_id | attribute_id | entity_id | value
------------------------------------------------------------------------------------------------------------------------
1 | 1 | 1 | 1 | painting
2 | 1 | 2 | 1 | myimage.gif
------------------------------------------------------------------------------------------------------------------------

(Note :- customer_entry_varchar.entity_id reference customer_entry.cust_entity_id
customer_entry_varchar.attribute_type_id reference eav_attribute_type.attribute_type_id and
customer_entry_varchar.attribute_id reference eav_attribute.attribute_id


And Out i need sir

OUT PUT
---------

------------------------------------------------------------------------
cust_entity_id | city | speciality | small_image
------------------------------------------------------------------------
1 | Ahmedabad | painting | myimage.gif
------------------------------------------------------------------------



Edited 1 time(s). Last edit at 11/27/2009 06:34PM by Harshad Goswami.

Options: ReplyQuote


Subject
Written By
Posted
Need select query for eav modeling
November 27, 2009 06:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.