How to do Lookup on a vertex in orientdb while loading data from another vertex

32 views
Skip to first unread message

Shivanandan Gupta

unread,
Feb 16, 2015, 4:25:06 AM2/16/15
to orient-...@googlegroups.com
Hi All,

I am trying to load a table where I have to lookup dimension table based on code  ( which is present in the stage table )


CITY Dimension table

ID CITY_NAME
1       LONDON
2       SINGAPORE
3       NEW YORK
4       SEATTLE

S_FACT FACT TABLE

PERSON_NAME       CITY 
ANDY                      SINGAPORE
SANDY                      LONDON
MANDY                        NEW YORK


F_FACT TABLE ( I want to load f_fact table by looking up to city dim using city_name from s_fact table equal to city_name in city_dimension and get the equivalent ID from dimension table )

PERSON_NAME    CITY_ID
ANDY                       2
SANDY                     1
MANDY                    3
 


Any help will be appreciated. Thanks in advance.

Shivanandan Gupta

unread,
Feb 16, 2015, 11:36:20 AM2/16/15
to orient-...@googlegroups.com
Got the solution for the solution for this , we can join these two tables on city_code and get the relevant city_id from city_dimension.


select *, $cityD as city_id from Sfact let cityD = ( select id from cityDim where cityName = $parent.$current.city )

Hope this will help many Newbies users of orientdb.
Reply all
Reply to author
Forward
0 new messages