Jump to content

Recommended Posts

The first query:

 

$RESULTDS=mssql_query("SELECT DV.[FY], DV.[EmpNo], DV.[NAME], DV.[EmpNo], M2.[NAMEL], M2.[NAMEF], M2.[NAMEMI], M2.[MSSNO], DV.[DATE OF SERVICE], DV.[^], DV.[sER(D-O-V-H)], DV.[CONSIDER], DV.[REIMBURSE] FROM DentalVisionHearing DV JOIN MASTERL2 M2 ON M2.[EMPNO]=DV.EmpNo

WHERE M2.[MSSNO] = '".$_SESSION['password']."'  and DV.[FY] = '$fiscal'

ORDER BY DV.[FY] desc");

 

The second query:

 

$RESULTDS=mssql_query("SELECT DV.[FY], DV.[EmpNo], DV.[NAME], DV.[EmpNo], M2.[NAMEL], M2.[NAMEF], M2.[NAMEMI], M2.[MSSNO], DV.[DATE OF SERVICE], DV.[^], DV.[sER(D-O-V-H)], DV.[CONSIDER], DV.[REIMBURSE] FROM DentalVisionHearing DV JOIN MASTERL2 M2 ON M2.[EMPNO]=DV.EmpNo

WHERE M2.[MSSNO] = '".$_SESSION['password']."' and DV.[FY] = '$fiscalprevious' 

ORDER BY M2.[MSSNO] desc");

 

The first query runs fine. If no records match current fiscal year, then it shows blank data. However.....if the first query pulls no records, then the second one won't, either.  ???

 

Cliffnotes:

 

If a person has matching records for the first query (current fiscal year), then the second query shows their previous fiscal year records just fine. But.... if no records match the first query (current fiscal year), then the second query (previous fiscal year) pulls no records, either, even though I know the records are there.

 

Thoughts?

 

Link to comment
https://forums.phpfreaks.com/topic/66892-query-help-please/
Share on other sites

Maybe this will clarify:

 

This screenshot is with my own info entered. I've used no Dental/Vision/Hearing reimbursement this fiscal year (2008), but I do have records for FY 2007.

 

DVH1.jpg

 

 

This next screenshot is of a gentleman who has used some reimbursement this fiscal year.

 

DVH2.jpg

 

As you can see, if records match in the first query, then the second one runs fine. If not, then the second query pulls nothing.

 

Link to comment
https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-335500
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.