How to make the following join?
Q:
开发者_运维问答- I have a DataTable result from the following query:
SELECT UNIQUE a.crsnum_e , a.crsnum_e || '/ ' || a.crstteng crs_name, b.period , b.crscls , c.crsday , c.from_lect , c.to_lect , c.to_lect - c.from_lect + 1 Subtraction, c.lect_kind
FROM rg1course a , rg3crsgrp b , ct1table c , ct1tablelect d
WHERE a.crsnum = b.crsnum
AND b.crsnum = c.crsnum
AND b.crscls = c.crscls
AND b.batch_no = c.batch_no
AND c.serial_key = d.serial_key
AND d.lect_code = ....
AND b.batch_no = ....
- I have another DataTable:Consists of:(Comes from another database table).
batch_no p.k
crsnum p.k
lect_code p.k
evaluation
What i would to do is to:
join the two datatables , where i need the evaluation
column in the result even if it is = null
. I mean i need always to get the first datatable
even it it's not have any instance in the second data table.
How to do this with :
INFORMIX JOIN.
or
LINQ.
The pimary keys(batch_no,crsnum,lect_code).
In Informix, to specify an outer join you need to do the following:
FROM table1 t1, OUTER table2 t2
WHERE t1.batch_no = t2.batch_no and ...
The resulting dataset would be all records from table1 and any records from table2 that match on the WHERE condition (and NULLs where it doesn't match).
If you want to do this in LINQ, this article has a good explanation with examples: http://smehrozalam.wordpress.com/2009/06/10/c-left-outer-joins-with-linq/
精彩评论