G
Guest
Ok. Here is a query that I am working with:
SELECT X.id, Y.year
FROM program AS X LEFT JOIN financial AS Y
ON X.fin_no = Y.fin_no
So basically I am looking up an id in X. Matching the fin_no in A to the
fin_no in Y. And printing out the corresponding years that each id was
active. Now I use the left join because not all ids are represented in Y and
I would just like a blank in the year column if this is true. Now the
financial table is set up like this:
stuff | MONTH | YEAR | stuff
1 2001
2 2001
3 2001
4 2001
etc.
I only want the data for the year from the row were MONTH = 12. When I do
the WHERE Y.MONTH = "12" then it blocks out all of the ids that had no
financial data because there was no month field to match the "12" to. So how
can I narrow my results down to the 12th month and still have the ids with no
financial data displayed with just a null value were the year would be. Im
sorry if this is confusing
Mark
SELECT X.id, Y.year
FROM program AS X LEFT JOIN financial AS Y
ON X.fin_no = Y.fin_no
So basically I am looking up an id in X. Matching the fin_no in A to the
fin_no in Y. And printing out the corresponding years that each id was
active. Now I use the left join because not all ids are represented in Y and
I would just like a blank in the year column if this is true. Now the
financial table is set up like this:
stuff | MONTH | YEAR | stuff
1 2001
2 2001
3 2001
4 2001
etc.
I only want the data for the year from the row were MONTH = 12. When I do
the WHERE Y.MONTH = "12" then it blocks out all of the ids that had no
financial data because there was no month field to match the "12" to. So how
can I narrow my results down to the 12th month and still have the ids with no
financial data displayed with just a null value were the year would be. Im
sorry if this is confusing
Mark