Questions tagged [on-clause]

34 questions
0
votes
1 answer

Customize JPA CriteriaQuery's on-clause

Is there a way to further restrict a join by adding some expressions? With plain sql i write: SELECT c.*, COUNT(i.id) invoice_count FROM customers c LEFT JOIN invoices i ON i.customer_id = c.id AND i.creation_time >= '2012-01-01' -- <= extra…
mazatwork
  • 1,275
  • 1
  • 13
  • 20
0
votes
2 answers

Any possible way to add parameters to ON clause on include left joins on rails?

I have a huge complex query like this: @objects = Object.joins({ x: :y }).includes( [:s, { x: { y: :z } }, { l: :m },:q, :w, { important_thing: [:h, :v, :c,:l, :b, { :k [:u, :a] }] } ]).where(conditions).order("x.foo,…
Bernardo Mendes
  • 1,220
  • 9
  • 15
0
votes
2 answers

Why subquery doesn't work in ON clause in DB2

Why this simple query works fine in oracle but doesn't work in DB2: select * from sysibm.dual d1 left join sysibm.dual d2 on 1=1 and exists (select 1 from sysibm.dual) Moving subquery-involving condition to where clause may help, but that will…
user1741227
  • 9
  • 1
  • 2
0
votes
1 answer

Multiple on clause using codeigniter active record

I need to do a multiple on clause on a left join query using codeigniter active record. I write this code: $this->db->join('table1', 'table1.col1 = table2.id', 'left'); $this->db->where_not_in('table.col2', $list); by doing this codeigniter add…
pindol
  • 2,110
  • 6
  • 35
  • 52
1 2
3