Phucon-
FROM AttrTbl AS a LEFT JOIN
WHERE (((a.Aid)=12345) AND ((a.Adate)=99991231);
Thank you all.
"causes an outer join to fail" I was trying to say my Left Outer Join query display an Inner Join result. Sorry for the confusion.
The table's stored in SQL Server(s), and is located in another state. The tables are big and are read only tables. I would say a hundred thousand rows. The ID field is the indexed field.
My querie's exactly like Crystal discribed. I do have CRITERIA in the outer joined table. Why does it shows only Inner Join result when there's criteria in the query?
Below is the SQL that I've tried.
'the result of this query displays only Inner Join
SELECT DISTINCT a.Aid, a.Acity, a.Astate, a.Adate, f.Fid, f.ASSETS, f.AssetsDate
FROM AttrTbl a LEFT JOIN FinTbl f ON a.Aid = f.Fid
WHERE (((a.Aid)=12345) AND ((a.Adate)=99991231) AND ((f.Assetsdate)=20140331));
'i then tried another approach, do it in 3 steps, then i got the correct result - the Outer Join.
'step 1 get the attribute info
SELECT DISTINCT a.Aid, a.Acity, a.Astate, a.Adate
FROM AttrTbl
WHERE (a.Aid = 12345) And (a.Adate = 99991231)
'step 2 get the financial info, filter by financial date
SELECT f.Fid, f.ASSETS, f.AssetsDate
FROM FnTbl f
WHERE f.dt=20140331;
'step 3 get final output, join the 2 queries
SELECT a.*, f.* FROM qryA a LEFT JOIN qryF ON a.Aid = f.Fid
What are the other better ways to code, besides the 3 steps approach?
Thank you again.
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (8) |
Tidak ada komentar:
Posting Komentar