|
-
April 28th, 2005, 03:34 PM
#1
return null fields ok
Code:
select table1.field1, table1.field2, table2.field1, table2.field2
from table1, table2
where
table2.field2 is not null and
table2.field2 is not null and
table2.fieldc = 5 and
table2.fieldd = table1.fieldd
group by table1.field1, table1.field2, table2.field1, table2.field2
this query works if table2.field1 and table2.field2 are not null.
But, if these fields are null it does returns nothing.
It is ok if table2.field1, table2.field2 return as null.
how to modify above query to do this?.
-
April 28th, 2005, 03:41 PM
#2
Re: return null fields ok
Code:
select table1.field1, table1.field2, table2.field1, table2.field2
from table1, table2
where
table2.fieldc = 5 and
table2.fieldd = table1.fieldd
group by table1.field1, table1.field2, table2.field1, table2.field2
- petter
-
April 29th, 2005, 04:22 AM
#3
Re: return null fields ok
It does not make sense to me. U R using "GROUP BY" without any agregate function (like SUM,COUNT etc).There are no errors but it doesn't mean that it works! U can skip "GROUP BY".
And I don't understand what U are trying to achieve. Is it OUTER JOIN U looking for?
Best regards,
Krzemo.
-
April 30th, 2005, 08:09 PM
#4
Re: return null fields ok
First off let's see what yo are after. Can you post an example of the table data and what yu expect the results to be. Also, you are using the older ansi join syntax method which most databases have moved away from to the newer INNER JOIN, OUTER JOIN options, what system are yu developing against?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|