How can i show all vertices in orientdb except where #class="movie"? - orientdb

Hi there i want to show all Vertices except the ones called movie.
my statement so far was
SELECT * FROM V WHERE NOT #class="movie"
but unfortunately the response does not contain any records. can anybody explain this to me ? :) Thank you :)

what version are you using? If I try in 3.0.0 your query work but you have to use "class" :
SELECT * FROM V WHERE NOT #class="movie"

Cool i solved it by using:
SELECT * FROM V WHERE #class!="movie"
thanks for your help Idacrema :)

Related

Symfony doctrine using IS DISTINCT FROM

I'm having a problem with using IS DISTINCT FROM with symfony. In my case I want sth like this
SELECT * FROM table orders AS o WHERE o.orderer_id IS DISTINCT FROM o.operator_id
It works fine if I run by using pgAdmin(Postgresql), but I don't know how to write with symfony doctrine. I tried to search about this, but no result for me, so anyone can help. Thanks in advance.
thanks zerkms, I achieve this by
$queryBuilder->andWhere($queryBuilder->expr()->orX(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->isNotNull('tem.operator'),
$queryBuilder->expr()->andX(
$queryBuilder->expr()->neq('tem.orderer', 'tem.operator'),
$queryBuilder->expr()->neq('tem.enterprise', 'tem.operator')
)
),
$queryBuilder->expr()->isNull('tem.operator')
));

Sailsjs-Waterline : How to filtering after populate?

I'm using sailjs + waterline, how to filtering data after populate models? here i try my code and doesn't work :
Approductbranch
.find({deleted:1})
.populate("mproduct_id",{where:{deleted:1}})
.paginate({page:currpage,limit:utils.RowPerPage})
.exec(callback)
in my code above, i want to execute sql like this :
select * from approductbranch a
inner join mproduct a
on a.id = a.mproduct_id
where a.deleted = 1
and b.deleted = 1
how to do this? thank! :)
Good question.
There currently isn't a way to do this directly, but there is an outstanding feature request in the Waterline repository that you can share your thoughts in.
I think you can do like this:
Approductbranch
.find({deleted:1})
.populate("mproduct_id",{deleted:1, skip:currpage * utils.RowPerPage, limit:utils.RowPerPage})
.exec(callback)
it will be OK!
You can filter a set of values before you populate. This is more performant since you're not getting more values than you need: https://github.com/balderdashy/sails-docs/blob/master/reference/waterline/queries/populate.md

Postgresql Issue

I'm trying to do a join with a LEFT(column,5) but I am not getting the syntax right. Of the code below how should I be accomplishing this? I'm usually doing MSSQL so I'm not sure if the syntax is different or I'm just doing something wrong.
select * from ofbiz.supplier_product a
join ofbiz.supplier_product b on a.(LEFT(prod_catalog_id,5)) = b.party_id
Thanks
Try this:
select * from ofbiz.supplier_product a
join ofbiz.supplier_product b on LEFT(a.prod_catalog_id,5) = b.party_id

Raw select using jenssegers Laravel-MongoDB

I add jenssegers Laravel-MongoDB package into my Laravel 4.2 project, and have a one problem. Maybe can help me. I cann't use DB::raw in select or get method. I need to change name of select column and add columns into one column, but Laravel return me an error.
I try to do something like this:
$arr = StudentMark::join('students', 'students.id','=','student_marks.student_id')
->select(array('student_marks.id',DB::raw('CONCAT(students.name, " ",
students.surname, " (", students.index,") ") AS student')))->get();
But Laravel return me an error:
{"error":{"type":"ErrorException","message":"Illegal offset type","file":".....vendor\\jenssegers\\mongodb\\src\\Jenssegers\\Mongodb\\Query\\Builder.php","line":240}}
Can anybody help me?
I use select with columns, and concating columns do in foreach of results and then return to client, and that solve me a problem. :)

Zend_Db_Table_Abstract - How to do a SUM?

I can't find here: http://framework.zend.com/manual/en/zend.db.select.html
any reference to SUM using mysql.
How can we perform a simple:
SELECT SUM(mark) as total_mark FROM `student`
Using Zend_Db_Table_Abstract ?
Tried:
this->select(SUM ('myintcolumn'))->from('mytable');
No luck. :(
Thanks,
MEM
did you try
this->select()->from('mytable', array('sum(myintcolumn) as sum'));
This is another less hardcoded way:
$this->select()->from($this, new Zend_Db_Expr("SUM(myintcolumn)"));
$select->from($this->_name, array('mytable'=> new Zend_Db_Expr('SUM(myintcolumn)')));