如何从边连接的另一个类中选择属性

时间:2017-06-09 17:49:41

标签: sql database select orientdb orientdb2.2

我有两个班级提名者学生都通过名为提名的

的边连接

从命名者中选择

{
    "result": [
        {
            "@type": "d",
            "@rid": "#73:2",
            "@version": 12,
            "@class": "Nominator",
            "out_nominatedUnder": [
                "#134:1",
                "#135:1",
                "#136:1"
            ],
            "in_noinatedUnder": [

            ],
            "isTemp": "false",
            "id": "JJRXW",
            "Email": "testuser@test.com",
            "Name": "nijeesh",
            "Phone": "7894561234",
            "school": "#65:2",
            "out_nomineeOf": [
                "#137:0"
            ],
            "@fieldTypes": "out_nominatedUnder=g,in_noinatedUnder=g,school=x,out_nomineeOf=g"
        },
        {
            "@type": "d",
            "@rid": "#73:3",
            "@version": 5,
            "@class": "Nominator",
            "out_nominatedUnder": [
                "#134:2"
            ],
            "isTemp": "true",
            "id": "48SPB",
            "Email": "newtestusr@mail.com",
            "Name": "test",
            "Phone": "1234567890",
            "school": "#65:2",
            "out_nomineeOf": [
                "#138:0"
            ],
            "@fieldTypes": "out_nominatedUnder=g,school=x,out_nomineeOf=g"
        },
        {
            "@type": "d",
            "@rid": "#74:0",
            "@version": 6,
            "@class": "Nominator",
            "out_nominatedUnder": [
                "#129:3",
                "#130:3",
                "#131:3"
            ],
            "isTemp": "true",
            "id": "SU7SV",
            "Email": "npms@school.com",
            "Name": "pon muthu",
            "Phone": "7778455215",
            "school": "#65:2",
            "@fieldTypes": "out_nominatedUnder=g,school=x"
        },
        {
            "@type": "d",
            "@rid": "#74:1",
            "@version": 6,
            "@class": "Nominator",
            "out_nominatedUnder": [
                "#132:2",
                "#133:2"
            ],
            "isTemp": "true",
            "id": "KKRM5",
            "Email": "nnnnn@jjj.com",
            "Name": "nnnnnn",
            "Phone": "4165616554",
            "school": "#65:2",
            "out_nomineeOf": [
                "#139:0"
            ],
            "@fieldTypes": "out_nominatedUnder=g,school=x,out_nomineeOf=g"
        },
        {
            "@type": "d",
            "@rid": "#75:1",
            "@version": 2,
            "@class": "Nominator",
            "isTemp": "true",
            "id": "4DZ86",
            "Email": "sivaraj@testschool.com",
            "Name": "sivaraj",
            "Phone": "7788899445",
            "school": "#65:2",
            "out_nominatedUnder": [
                "#136:2"
            ],
            "@fieldTypes": "school=x,out_nominatedUnder=g"
        },
        {
            "@type": "d",
            "@rid": "#76:1",
            "@version": 4,
            "@class": "Nominator",
            "out_nominatedUnder": [
                "#135:2"
            ],
            "isTemp": "true",
            "id": "HFQJ1",
            "Email": "klndk@knvd.com",
            "Name": "dbhbsd",
            "Phone": "8656548745",
            "school": "#65:2",
            "@fieldTypes": "out_nominatedUnder=g,school=x"
        }
    ],
    "notification": "Query executed in 0.012 sec. Returned 6 record(s)"
}`

从学生中选择

{
    "result": [
        {
            "@type": "d",
            "@rid": "#81:2",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#135:1"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "DPIVOZ",
            "Dob": "1993-07-03 00:00:00",
            "Aim": "engineer",
            "Gname": "LBQUWA",
            "GPhone": "86611059530",
            "studentId": "86611059530",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#81:3",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#136:2"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "YNRUFI",
            "Dob": "2007-04-03 00:00:00",
            "Aim": "scientist",
            "Gname": "JACIJE",
            "GPhone": "40086333516",
            "studentId": "40086333516",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#82:2",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#129:3"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "CEYUSF",
            "Dob": "1995-10-04 00:00:00",
            "Aim": "doctor",
            "Gname": "OLMIIN",
            "GPhone": "73410614255",
            "studentId": "73410614255",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#82:3",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#133:2"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "ESUGYX",
            "Dob": "1993-08-04 00:00:00",
            "Aim": "astronaut",
            "Gname": "XQFUTB",
            "GPhone": "45293704319",
            "studentId": "45293704319",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#83:2",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#130:3"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "HLKRGE",
            "Dob": "1992-03-18 00:00:00",
            "Aim": "teacher",
            "Gname": "TEFZBC",
            "GPhone": "69599861374",
            "studentId": "69599861374",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#83:3",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#134:2"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "WXAKXS",
            "Dob": "2009-10-18 00:00:00",
            "Aim": "police",
            "Gname": "YJPHDM",
            "GPhone": "46114343262",
            "studentId": "46114343262",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#84:2",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#131:3"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "MCDTIE",
            "Dob": "2003-11-26 00:00:00",
            "Aim": "artist",
            "Gname": "STUCRE",
            "GPhone": "61685522175",
            "studentId": "61685522175",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#85:2",
            "@version": 9,
            "@class": "Student",
            "in_nominatedUnder": [
                "#136:1"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "AOCRNL",
            "Dob": "2013-12-26 00:00:00",
            "Aim": "scientist",
            "Gname": "YRRHBY",
            "GPhone": "55210013",
            "studentId": "55210013",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#86:2",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#135:2"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "SNCYQR",
            "Dob": "2002-09-12 00:00:00",
            "Aim": "astronaut",
            "Gname": "XMBFHO",
            "GPhone": "26155031068",
            "studentId": "26155031068",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#87:1",
            "@version": 6,
            "@class": "Student",
            "in_nominatedUnder": [
                "#132:2"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "TQYIXQ",
            "Dob": "1996-08-27 00:00:00",
            "Aim": "police",
            "Gname": "DRLLWC",
            "GPhone": "76276222353",
            "studentId": "76276222353",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        },
        {
            "@type": "d",
            "@rid": "#88:1",
            "@version": 10,
            "@class": "Student",
            "in_nominatedUnder": [
                "#134:1"
            ],
            "out_noinatedUnder": [

            ],
            "Name": "GEFVAK",
            "Dob": "1998-08-01 00:00:00",
            "Aim": "solidier",
            "Gname": "UEHKKJ",
            "GPhone": "34002926291",
            "studentId": "34002926291",
            "Area": "#57:2",
            "registerdSchool": "#65:2",
            "@fieldTypes": "in_nominatedUnder=g,out_noinatedUnder=g,Dob=t,Area=x,registerdSchool=x"
        }
    ],
    "notification": "Query executed in 0.017 sec. Returned 11 record(s)"
}

我的问题是如何选择所有以工程师为目标的学生,并以提名人名称nijeesh提名

1 个答案:

答案 0 :(得分:1)

试试这个:

select from Students where aim = "engineer" and in('nominateUnder').name contains "nijeesh"

希望它有所帮助。

此致