Solved Not Fetching Data From Both Tbls (1 Viewer)

Ashfaque

Student
Local time
Today, 20:48
Joined
Sep 6, 2004
Messages
894
Hi,
Code:
SELECT T_ProjectBaseContracts.ID, T_ProjectBaseContracts.ContractPreparationDate, T_ProjectBaseContracts.EFirstParty, T_ProjectBaseContracts.ESecondParty, T_ProjectBaseContracts.ProjNum, T_ProjAssineeHeader.ProjNum, T_ProjAssineeHeader.ProjAssigneeName
FROM T_ProjectBaseContracts INNER JOIN T_ProjAssineeHeader ON T_ProjectBaseContracts.ID = T_ProjAssineeHeader.ID
WHERE (((T_ProjAssineeHeader.ProjAssigneeName)<>IsNull([ProjAssigneeName])));
Have primary and secondary table. Both have one record.

The projnum is common field in secondly tbl that I used to Identify the data. But when executing above query, empty record is generating.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:18
Joined
Feb 28, 2001
Messages
27,162
WHERE (((T_ProjAssineeHeader.ProjAssigneeName)<>IsNull([ProjAssigneeName])));
When you make this comparison, you have what amounts to an impossible situation. I'm going to GUESS that ProjAssigneeName is text. But IsNull(ProjAssigneeName) is going to be either TRUE or FALSE.

Perhaps you meant WHERE IsNull( T_ProjAssineeHeader.ProjAssigneeName ) <> TRUE ; ?

I understand that English might not be your primary language but try to describe in words what you are trying to accomplish.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:18
Joined
May 21, 2018
Messages
8,527
Code:
SELECT column_names
FROM table_name
WHERE column_name IS NOT NULL;
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:18
Joined
Feb 28, 2001
Messages
27,162
Thanks, MajP - I always forget that SQL and VBA differ on this syntax. But of course, you are right about the way to test for nulls in SQL context. Except maybe shouldn't that be "NOT (XXX IS NULL)" ? EDIT: Never mind, you got it right. It was so long ago that I needed that particular case that I had to look it up.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:18
Joined
May 7, 2009
Messages
19,230
if the ID's on both tables are Autonumber (therefore, the tables are Unrelated).
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:18
Joined
May 21, 2018
Messages
8,527
@The_Doc_Man
But of course, you are right about the way to test for nulls in SQL context. Except maybe shouldn't that be "NOT (XXX IS NULL)" ? EDIT: Never mind, you got it right. It was so long ago that I needed that particular case that I had to look it up.
Both work AFAIK
where not field is null
where field is not null
 

Users who are viewing this thread

Top Bottom