This topic is locked
[SOLVED]

 SQL Query for chart INNER JOIN

10/6/2011 7:43:17 PM
PHPRunner General questions
S
stiven author

Hello, I have created a chart and it works fine the only thing is that i need to put a conditional WHERE and when i do it, it won't work it shows as No Data on the page. Does anyone know if something is wrong with this query? the conditional depends on the user that is logged in.
Thanks


SELECT

COUNT(Expedientes.`Case #`) AS CASES,

MONTH(`Vital Info`.`Fecha Actual`) AS `Month`,

YEAR(`Vital Info`.`Fecha Actual`) AS `Year`

FROM Expedientes

INNER JOIN `Vital Info` ON Expedientes.`Case #` = `Vital Info`.`Case #`

WHERE (Expedientes.Consejera = '".$_SESSION["UserID"]."')

GROUP BY YEAR(`Fecha Actual`), MONTH(`Fecha Actual`)
C
cgphp 10/6/2011

In the "Chart page: Before SQL query" event enter the following code:

$strWhereClause = whereAdd($strWhereClause, "Expedientes.Consejera = '".$_SESSION["UserID"]."');
S
stiven author 10/6/2011



In the "Chart page: Before SQL query" event enter the following code:

$strWhereClause = whereAdd($strWhereClause, "Expedientes.Consejera = '".$_SESSION["UserID"]."');



Thank you very much I tried to do this on the events page but it didn't work i had probably misspelled something.. but it works now thank you very much! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=61299&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />