jteixeira Posted November 14, 2006 Share Posted November 14, 2006 I have this query -->Select Avarias.Maquinaid,nicname,Avarias.tipo,NomeAvaria,Avarias.duracao,(Avarias.duracao/1440) as "DiaAvariados"From Avarias INNER JOIN Maquina on maquina.maquinaid=Avarias.maquinaid INNER JOIN DESCAvarias on descavarias.TipoAvaria=Avarias.tipoWhere duracao>=1440Group by Avarias.Maquinaid,nicname,Avarias.tipo,NomeAvaria,Avarias.duracaoAnd i want print for each if the time is more then 1 week Link to comment Share on other sites More sharing options...
aspnetguy Posted November 14, 2006 Share Posted November 14, 2006 I don't understand. What time? Could you translate your query to english? thanks. Link to comment Share on other sites More sharing options...
jteixeira Posted November 14, 2006 Author Share Posted November 14, 2006 Select breakdown.machineid,nicname,breakdown.type,breakdownName,breakdown.duraction,(breakdown.durantion/1440) as "Daysbreakdown"From breakdown INNER JOIN Machine on machine.machineid=breakdown.machineid INNER JOIN DESCbreakdown on DESCbreakdown.breakdownType=breakdown.typeWhere duration>=1440Group by breakdown.Machineid,nicname,breakdown.type,breakdownName,breakdown.duration1440 -> number of minutes per dayI want to print per breakdown if the breakdown Time is bigger ther 1440 Link to comment Share on other sites More sharing options...
aspnetguy Posted November 14, 2006 Share Posted November 14, 2006 Doesn't this query already returnt he results you want? If not, what is it doing.Can you define what you mean by "print"? Do you just want to return the records, display them on the screen, or something else? Link to comment Share on other sites More sharing options...
jteixeira Posted November 14, 2006 Author Share Posted November 14, 2006 i want that apears a message to say if the breakdown passes 1 day Link to comment Share on other sites More sharing options...
aspnetguy Posted November 14, 2006 Share Posted November 14, 2006 you could do somethign like this in PHP $data = mysql_query($sql);while($row = mysql_fetch_array($data)){ echo "<p>Breakdown duration is greater than 1440 for machine ID: " . $row['breakdown.machineid'] . "!</p>";} Link to comment Share on other sites More sharing options...
jteixeira Posted November 14, 2006 Author Share Posted November 14, 2006 this works in Microsoft SQL SERVER EXPRESS? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 15, 2006 Share Posted November 15, 2006 I don't know, does it?The query probably works. PHP doesn't have anything to do with SQL Server (but, you didn't specify you were using SQL Server). If you are using ASP instead of PHP, or something else like Cold Fusion, then the syntax will be a little different. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now