.net and mysql join

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i'm curious if there are any known issues with the 2. i've tried it in vc#
and vb and i get the same results with both.

every time i run a join and it gets to a 0 or null it makes everything
following it in that column null. the mysql statement is:

"select customers.name, customers.firstname, customers.customerid,
customers.contact, customers.memorec, extinfo.info, memos.memo from customers
left join extinfo on customers.rec=extinfo.rec left join memos ON
customers.memorec=memos.rec where customers.rec=extinfo.linkrec and
extinfo.identifier=1 and extinfo.primarytype=2 and customers.inactive=0 order
by customers.name asc"

the memorec points to the coresponding rec in the memo file. the problem is
that if a customer has a 0 memorec (no memo) then the dataset makes it null
and all the memos following it. is this a known bug or am i doing something
wrong? is there a better way to do this?
 
Hi

Of course I don't know the table schemas of your tables and what is the
contentent of the tables but a possible problem could be that you compare
null values with zeros or null values with null vlaues.

customers.memorec=memos.rec

The statement above could be evaluated to:

0 =null
null = null

This could give you no match.

You could try something like that:

isnull(customers.memorec,0,customers.memorec) = isnull(memos.rec,0,memos.rec)
 
Back
Top