Moron Posted January 7, 2009 Share Posted January 7, 2009 The situation is that I'm pulling data from three tables. In one of them, I need to specify ONLY a certain year. The query is: $RESULTDS=mssql_query("SELECT DISTINCT M2.[NAMEL], M2.[NAMEF], M2.[NAMEMI], M2.[EMPNO], M2.[MSSNO], M2.[MEMPAD], M2.[MEMPZI], M2.[MEMPCS], M2.[NAMETI], WF.[EMPN], WF.[W2YEAR], WF.[WEMPSX], WF.[WRET], WF.[EMPWH], WF.[EMPGRS], WF.[EMPFIC], WF.[EMPFGR], WF.[MEDTAX], WF.[FICATX], WF.[TERM], WF.[WTSTAT], WF.[WPYCTR], WF.[EMPUW], WF.[EMPINS], WF.[EMPDC], WF.[EMPPLN], WF.[EMPDR], WF.[EMPDR], FR.[FRAMT], FR.[FYEAR] FROM MASTERL2 M2 LEFT JOIN W2FILE WF ON M2.[EMPNO]= WF.[EMPN] LEFT JOIN FRINGE FR ON WF.[EMPN] = FR.[FEMPNO] WHERE M2.[EMPNO] = '".$_SESSION['empcode']."' ORDER BY WF.[EMPN] desc"); I can echo W2.[W2YEAR] and it comes up as 2008. FR.[FYEAR] does the same, 2008. Then why does FR.[FRAMT] keep pulling the record from 2007????? Thanks! Link to comment https://forums.phpfreaks.com/topic/139896-whats-wrong-with-this-query/ Share on other sites More sharing options...
Brian W Posted January 7, 2009 Share Posted January 7, 2009 sorry, I'm not much help because I have no f'n clue where to start reading that query. I don't see a W2.[W2YEAR] in your query. fill in this list please: the column name = what is held in this column MASTERL2.[EMPNO] = W2FILE.[EMPN] = FRINGE.[FEMPNO] = also, what is in $_SESSION['empcode'] (these questions may sound stupid, but I just can't seem to figure out what your trying to do here. Link to comment https://forums.phpfreaks.com/topic/139896-whats-wrong-with-this-query/#findComment-731992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.