Jump to content

Time


jteixeira

Recommended Posts

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...