Note that there are some explanatory texts on larger screens.

plurals
  1. POPre-done SQLs to be converted to Rails' style moduls
    text
    copied!<p>I am a Rails newbie and would really appreciate if someone converted these SQLs to complete modules for rails. I know its a lot to ask but I can't just use find_by_sql for all of them. Or can I?</p> <p>These are the SQLs (they run on MS-SQL):</p> <p><code>SELECT STANJA_NA_DAN_POSTAVKA.STA_ID, STP_DATE, STP_TIME, STA_OPIS, STA_SIFRA, STA_POND FROM STANJA_NA_DAN_POSTAVKA INNER JOIN STANJA_NA_DAN ON(STANJA_NA_DAN.STA_ID=STANJA_NA_DAN_POSTAVKA.STA_ID) WHERE ((OSE_ID=10)AND (STANJA_NA_DAN_POSTAVKA.STP_DATE&gt;={d '2010-03-30'}) AND (STANJA_NA_DAN_POSTAVKA.STP_DATE&lt;={d '2010-03-30'}))</code></p> <p><code>SELECT ZIGI_OBDELANI.OSE_ID,<br> ZIGI_OBDELANI.DOG_ID AS DOG_ID,<br> ZIGI_OBDELANI.ZIO_DATUM AS DATUM,<br> ZIGI_PRICETEK.ZIG_TIME_D AS ZIG_PRICETEK,<br> ZIGI_KONEC.ZIG_TIME_D AS ZIG_KONEC<br> FROM (ZIGI_OBDELANI INNER JOIN ZIGI ZIGI_PRICETEK ON ZIGI_OBDELANI.ZIG_ID_PRICETEK = ZIGI_PRICETEK.ZIG_ID )<br> INNER JOIN ZIGI ZIGI_KONEC ON ZIGI_OBDELANI.ZIG_ID_KONEC = ZIGI_KONEC.ZIG_ID<br> WHERE (ZIGI_OBDELANI.OSE_ID = 10) AND (ZIGI_OBDELANI.ZIO_DATUM &gt;= {d '2010-03-30'}) AND (ZIGI_OBDELANI.ZIO_DATUM &lt;= {d '2010-03-30'}) AND (ZIGI_PRICETEK.ZIG_VELJAVEN &lt;&gt; 0) AND (ZIGI_KONEC.ZIG_VELJAVEN &lt;&gt; 0)<br> ORDER BY ZIGI_OBDELANI.OSE_ID, ZIGI_PRICETEK.ZIG_TIME ASC</code></p> <p>These SQLs are daily working hours and I got them as is. Also I got Database with it which (as you can see from the SQL-s) is not in Rails conventions. As a P.S.:</p> <ol> <li><p>Things like STP_DATE>={d'2010-03-30'}) are of course dates (in Slovenian date notation) and will be replaced with a variable (date), so that the user could choose date from and date to.</p></li> <li><p>All of this data will be shown in the same page in the table,so maybe all in one module? Or many?; if this helps, maybe.</p></li> </ol> <p>So can someone help me? Its for my work and its my 1st project and I am a Rails newbie and the bosses are getting inpatient(they are getting quite loud actually)</p> <p>Thank you very very much!</p> <p>So again I would really apreciate if someone could do a relevant model part for at least one of the complicated SQLs. I will read all the data in one controller and in one action. All will be done in one run. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload