I have this template for my database:
I want to do a query that return all the "Ontologie" linked to one specific "Rubrique".
It can take all the edge except "Facultatif".
I actually have this query that return all the "Ontologie" but it doesn't pass by "Regle" so i don't have every "Ontologie"
SELECT *
FROM (
SELECT expand(in('Synonyme').in('Identifie').in('Regroupe'))
FROM Rubrique
WHERE libelle = "collèges, lycées avec internat"
)
Thanks.
You could use
select expand($c)
let $a = ( SELECT * FROM (
SELECT expand(in().in('Identifie').in('Regroupe'))
FROM Rubrique
WHERE libelle="collèges, lycées avec internat"
)),
$b = ( SELECT * FROM (
SELECT expand(in('Pertinent').out('Obligatoire'))
FROM Rubrique
WHERE libelle="collèges, lycées avec internat"
)),
$c=unionAll($a,$b)
Hope it helps
Related
I am trying to delete with a select and I tried to follow the instructions in the others post.
Now, my query doesn't return an error but it won't stop running.
I have almost 120k lines in the table cours, 120k lines in the table liste_des_cours_has_cours and 30 lines in liste_des_cours
delete from cours where Id_cours in
(
select cours.Id_cours from (select * from cours) as courssub1
where Id_cours not in
(
select cours.Id_cours from (select * from cours) as courssub2
join (liste_des_cours_has_cours, liste_des_cours)
on courssub2.Id_cours = liste_des_cours_has_cours.Id_cours and liste_des_cours_has_cours.Id_liste_des_cours = liste_des_cours.Id_liste_des_cours
)
);
You can try something like
delete c
from liste_des_cours_has_cours a inner join liste_des_cours b
on a.Id_liste_des_cours = b.Id_liste_des_cours
right join cours c
on c.Id_cours = a.Id_cours
where a.Id_cours is null;
Check here Demo
This is my schema:
My objective is capture that purple Vertex with name "Paragrafo" and have connection with the Vertex "1" AND "2", in this case will be the #29:426.
I tried:
SELECT EXPAND( BOTH( 'Contem' ) ) FROM Topico WHERE Assunto = '1' and Assunto = '2'
or
SELECT * FROM Topico WHERE Assunto = '1' and Assunto = '2'
or
SELECT FROM ( SELECT EXPAND(BOTHE('Contem')) FROM Topico WHERE Assunto='2' and Assunto = '1')
The AND operator make the query return None.
It's possible to make a query to do that?
I'm doing my schema right?
Thanks.
Try this:
select from Topico where out().<property_name> contains '1' AND out().<property_name> contains '2'
Hope it helps
Regards
I need to compare one specific vertex to all other and print if they have exactly the same outE("Pertinent", "Secondaire")
here is the request i made :
SELECT $b
let $a = (
SELECT *
FROM Regle
WHERE titre="1823 - accessoires poids lourds tachygraphe"
),
$b = (
SELECT *
FROM Regle
WHERE out("Pertinent", "Secondaire") = $a.out("Pertinent", "Secondaire")
)
Thanks in advance
You could use
SELECT expand($b)
let $a = (
SELECT *
FROM Regle
WHERE titre="1823 - accessoires poids lourds tachygraphe"
),
$b = (
SELECT *
FROM Regle
WHERE out("Pertinent").#rid in $a.out("Pertinent").#rid and out("Secondaire").#rid in $a.out("Secondaire").#rid
)
Hope it helps.
Look the Match
SELECT PSQ_psq_nome AS nome, INS_ins_nome AS instituicao, COUNT(PUB_pub_id) AS qtdpub, * FROM (
MATCH
{class:Pais, as:PAI, where:(pai_id=1)} <-NASCEU- {class:Pesquisador, as:PSQ} -PUBLICOU-> {class:Publicacao, as:PUB, where: (pub_data_publicacao_int > 20141231)},
{as:PSQ} -ATUOU-> {class:Instituicao, as:INS}
RETURN PSQ.psq_nome AS nome, INS.ins_nome AS instituicao, PUB.pub_id, PUBLICOU.ordem )
GROUP BY PSQ_psq_nome, INS_ins_nome
ORDER BY qtdpub DESC, nome
I need use the property ordem, type integer, for the edge PUBLICOU. Is it possible?
something like (see PUBLICOU)
SELECT PSQ_psq_nome AS nome, INS_ins_nome AS instituicao, COUNT(PUB_pub_id) AS qtdpub, * FROM (
MATCH
{class:Pais, as:PAI, where:(pai_id=1)} <-NASCEU- {class:Pesquisador, as:PSQ} -PUBLICOU { where: (ordem = 1) -> {class:Publicacao, as:PUB, where: (pub_data_publicacao_int > 20141231)},
{as:PSQ} -ATUOU-> {class:Instituicao, as:INS}
RETURN PSQ.psq_nome AS nome, INS.ins_nome AS instituicao, PUB.pub_id, PUBLICOU.ordem )
GROUP BY PSQ_psq_nome, INS_ins_nome
ORDER BY qtdpub DESC, nome
Sure, but you cannot use arrow notation, eg. you have to replace
{class:Pesquisador, as:PSQ} -PUBLICOU-> {class:Publicacao ...}
with
{class:Pesquisador, as:PSQ} .outE("PUBLICOU"){where:(ordem = 1)}.inV() {class:Publicacao ...}
You can also assign an alias to the edge and return it in the result set if you wish
I have a tabe valued function called "GetLogInfosMsg" which I want to run provided with some Parameters from a specific table. The code below does not work; I get the message "Only one expression can be specified in the select list when the sub-query is not introduced with EXISTS.". Can somebody help me? Thanks.
SELECT
#pErrMsgID = [MsgID],
#pParams = [Params]
FROM
[dbo].[GetLogInfoMsg]((SELECT
[FIELD1],
[FIELD2],
[FIELD3]
FROM [dbo].[TABLE1]
WHERE [TABLE1].[UUID] = #pUUID));
try this
you have to pass parameter in separate not in table format
SELECT #pErrMsgID = [MsgID] ,
#pParams = [Params]
FROM [dbo].[GetLogInfoMsg](( SELECT [FIELD1]
FROM [dbo].[TABLE1]
WHERE [TABLE1].[UUID] = #pUUID
), ( SELECT [FIELD2]
FROM [dbo].[TABLE1]
WHERE [TABLE1].[UUID] = #pUUID
), ( SELECT [FIELD3]
FROM [dbo].[TABLE1]
WHERE [TABLE1].[UUID] = #pUUID
)) ;
If you are using mssql 2005+ consider using this:
SELECT
#pErrMsgID = t2.[MsgID],
#pParams = t2.[Params]
FROM [dbo].[TABLE1] t1
CROSS APPLY (SELECT [MsgID], [Params]
FROM [dbo].[GetLogInfoMsg] (t1.FIELD1, t1.FIELD2, t1.FIELD3) t2
WHERE t1.[UUID] = #pUUID