Select Across Tables/Entities (Joins)

From: Emmanuel Okyere (chief-list..kyere.org)
Date: Tue Dec 28 2004 - 06:02:23 EST

  • Next message: Dave: "Re: localObjects()"

    Hello All:

    I am struggling with creating joins with cayenne; I've found a lot of
    posts on joins in the archives, but nothing (I have found) seems to
    provide a simple step-by-step method of creating simple joins (selects
    across tables).

    Assuming I have 4 tables (District, Ward, Village, SubVillage) and would
    want to perform the following query (for reporting purposes):

    select d.DISTRICT_NAME as district, w.WARD_NAME as ward, v.DESCRIPTION
    as village, count(1) as subvillages, sum(s.male_population) as male,
    sum(s.female_population) as female, v.cattle, v.livestock
    from DISTRICT d, WARD w, VILLAGE v, SUBVILLAGE s
    where d.DISTRICT_ID = w.DISTRICT_ID and w.WARD_ID = v.WARD_ID and
    v.VILLAGE_ID = s.VILLAGE_ID
    group by d.DISTRICT_NAME, w.WARD_NAME, v.DESCRIPTION, v.CATTLE, v.LIVESTOCK;

    what's the best route to go? So far (for me) everything points to the
    SqlSelectQuery class, but that is deprecated, so I was hoping somebody
    could show me the better way here.

    Many thanks,
    Emmanuel

    -- 
    

    Emmanuel Okyere II CTO - Akuaba, LLC http://akuaba.net/ http://okyere.org/ http://blogs.okyere.org/resolve MSN: compubandit AIM: compubndit

    Ecrasez l'infame! - Voltaire



    This archive was generated by hypermail 2.0.0 : Tue Dec 28 2004 - 06:02:30 EST