I novice rail and actually change any of these SQLs, so appreciated to complete module Rail will do. I know a lot to ask this but I can not just use find_by_sql for all of them? Or I can
These SQLs (they are running on MS- SQL):
STANJA_NA_DAN_POSTAVKA.STA_ID, STP_DATE, STP_TIME, STA_OPIS, STA_SIFRA, STA_POND selection STANJA_NA_DAN_POSTAVKA to 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'}))
select as the ZIGI_OBDELANI.OSE_ID, ZIGI_OBDELANI.DOG_ID
DOG_ID, ZIGI_OBDELANI.ZIO_DATUM the datum
, ZIGI_PRICETEK.ZIG_TIME_D
as ZIG_PRICETEK, ZIGI_KONEC.ZIG_TIME_D
ZIG_KONEC as well as
from (ZIGI_OBDELANI interiors are ZIGI_OBDELANI on Zigi ZIGI_PRICETEK. ZIG_ID_PRICETEK = ZIGI_PRICETEK.ZIG_ID)
Join Zigi ZIGI_KONEC on ZIGI_OBDELANI.ZIG_ID_KONEC = ZIGI_KONEC.ZIG_ID
ou (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)
ordered by ZIGI_OBDELANI.OSE_ID, ZIGI_PRICETEK.ZIG_TIME ASC
These SQLs are working daily hours and as I have found them. Apart from this, I got the database with it (as you can see from SQL S) Rail is not in conferences. As a PS: the
-
STP_DATE> = {d 2010-03-30 '}) Things are certainly dates (in Slovenian date notation) and give them a variable Will be replaced with (date), so that the user can choose the date and date.
-
All of this data will be displayed in the same page in the table, so possibly the module in all one? Or many? If it helps, it may be possible.
Can anyone help me? This is for my work and my first project and I am a railway novice and the bowel patients in the owners (they are getting very loud)
Thank you very much!
Again I really appreciate if someone could run a relevant model for at least one complex SQL. I will read all the data in one controller and in one task. All will be in one run. Actually it is to handle railways, make models for each table, and to create relationships inside.
Model.
Since this is a legacy model, you have to do the following
class Stange & lt; ActiveRecord :: Base set_table_name 'STANJA_NA_DAN' set_primary_key 'Your Primary Key' End Class Postavka & lt; ActiveRecord :: Base set_table_name 'STANJA_NA_DAN_POSTAVKA' set_primary_key 'STA_ID' has_many: stanjas,: foreign_key = & gt; 'Sta_id' ,: primary_key = & gt; 'Sta_id' end
something like that
success !!
Comments
Post a Comment