Click here to Skip to main content
15,886,788 members
Home / Discussions / Database
   

Database

 
GeneralRe: Oracle SQL query to MS-SQL Pin
Member 951930628-Jan-20 22:44
Member 951930628-Jan-20 22:44 
GeneralRe: Oracle SQL query to MS-SQL Pin
Mycroft Holmes29-Jan-20 10:59
professionalMycroft Holmes29-Jan-20 10:59 
Questionsplit time then group by 15 min mongodb Pin
Member 1300557210-Jan-20 21:56
Member 1300557210-Jan-20 21:56 
QuestionSQL Query with a Loop Pin
Bobby Underwood6-Jan-20 4:58
Bobby Underwood6-Jan-20 4:58 
AnswerRe: SQL Query with a Loop Pin
#realJSOP6-Jan-20 5:04
mve#realJSOP6-Jan-20 5:04 
AnswerRe: SQL Query with a Loop Pin
Bobby Underwood6-Jan-20 5:11
Bobby Underwood6-Jan-20 5:11 
AnswerRe: SQL Query with a Loop Pin
#realJSOP6-Jan-20 5:16
mve#realJSOP6-Jan-20 5:16 
GeneralRe: SQL Query with a Loop Pin
Bobby Underwood6-Jan-20 5:22
Bobby Underwood6-Jan-20 5:22 
select jh.Company, jh.JobClosed, jh.JobComplete, jh.JobEngineered, jh.JobReleased
, jh.JobNum, jh.PartNum, jh.RevisionNum, jh.PartDescription, jh.ProdQty, jh.IUM
, jh.StartDate as JobStartDate, jh.DueDate as JobDueDate, jh.ReqDueDate, jh.ProdCode, pg.Description as ProdDesc
, jh.JobFirm
, jh.Plant, pl.Name as Site
, jo.StartDate as OpStartDate, jo.DueDate as OpDueDate, jo.OpCode
, jo.OprSeq, jo.OpDesc
, jo.RunQty, jo.QtyCompleted
, SetupCost.SetupLabRate, SetupCost.SetupBurRate, ProdCost.ProdLabRate, ProdCost.ProdBurRate
, pp.MfgLotSize, jo.SetupComplete, jo.SetUpCrewSize, jo.EstSetHours, SetupCost.OpenSetupHrs, jo.SetupPctComplete, jo.ProdCrewSize, jo.EstProdHours, jo.ProdStandard
, SetupCost.SetupLabCost
, SetupCost.SetupBurCost
, jo.StdFormat

from JobHead jh
inner join ProdGrup pg on pg.Company = jh.Company and pg.ProdCode = jh.ProdCode
inner join Erp.PartPlant pp on pp.Company = jh.Company and pp.Plant = jh.Plant and pp.PartNum = jh.PartNum
inner join Erp.Plant pl on pl.Company = pp.Company and pl.Plant = pp.Plant
inner join JobOper jo on jo.Company = jh.Company and jo.JobNum = jh.JobNum
left outer join (select jods.Company, jods.JobNum, jods.OprSeq, jods.AssemblySeq, pps.MfgLotSize, Sum(jods.SetupLabRate) as SetupLabRate, Sum(jods.SetupBurRate) as SetupBurRate
, case when jos.SetupComplete = 0
then (Sum(jods.SetupLabRate) * jos.EstSetHours ) * (1 - (jos.SetupPctComplete / 100))
else 0
end as SetupLabCost

--This is the area needing the loop below***********************************

, case when jos.SetupComplete = 0
then
for ($i=0; $i<$count_row;$i++)
{
(((jods.SetupLabRate * jods.CrewSize) * jos.EstSetHours) * (1 - (jos.SetupPctComplete/100)))
}
else 0
end as SetupLabCost2


from Erp.JobOpDtl jods
inner join JobHead jhs on jhs.Company = jods.Company and jhs.JobNum = jods.JobNum
inner join JobOper jos on jos.Company = jods.Company and jos.JobNum = jods.JobNum and jos.AssemblySeq = jods.AssemblySeq and jos.OprSeq = jods.OprSeq
left outer join Erp.PartPlant pps on pps.Company = jhs.Company and pps.PartNum = jhs.PartNum and pps.Plant = jhs.Plant
where jods.SetupOrProd <> 'P'
group by jods.Company, jods.JobNum, jods.AssemblySeq, jods.OprSeq, pps.MfgLotSize, jos.EstSetHours, jos.SetupComplete, jos.SetupPctComplete
) as SetupCost
on SetupCost.Company = jo.Company and SetupCost.JobNum = jo.JobNum and SetupCost.OprSeq = jo.OprSeq and SetupCost.AssemblySeq = jo.AssemblySeq

where jh.JobEngineered = 1 and jh.JobComplete = 0 and jo.OpComplete = 0
AnswerRe: SQL Query with a Loop Pin
Jörgen Andersson7-Jan-20 5:52
professionalJörgen Andersson7-Jan-20 5:52 
Questionincorrect syntax near begin expecting external for Alter Procedure Pin
simpledeveloper27-Dec-19 9:23
simpledeveloper27-Dec-19 9:23 
AnswerRe: incorrect syntax near begin expecting external for Alter Procedure Pin
Jörgen Andersson27-Dec-19 23:14
professionalJörgen Andersson27-Dec-19 23:14 
QuestionAdding multiple columns with condition Pin
simpledeveloper26-Dec-19 14:58
simpledeveloper26-Dec-19 14:58 
AnswerRe: Adding multiple columns with condition Pin
Mycroft Holmes26-Dec-19 19:58
professionalMycroft Holmes26-Dec-19 19:58 
AnswerRe: Adding multiple columns with condition Pin
Jörgen Andersson27-Dec-19 3:40
professionalJörgen Andersson27-Dec-19 3:40 
GeneralRe: Adding multiple columns with condition Pin
simpledeveloper27-Dec-19 5:29
simpledeveloper27-Dec-19 5:29 
GeneralRe: Adding multiple columns with condition Pin
Jörgen Andersson27-Dec-19 5:32
professionalJörgen Andersson27-Dec-19 5:32 
GeneralRe: Adding multiple columns with condition Pin
simpledeveloper27-Dec-19 8:44
simpledeveloper27-Dec-19 8:44 
QuestionCrystal Report to SQL server 2012 database Pin
Member 1447460719-Dec-19 10:39
Member 1447460719-Dec-19 10:39 
QuestionBackup rows tables of SQL Server database by SMO base on colums's value Pin
Member 1417466417-Dec-19 14:39
Member 1417466417-Dec-19 14:39 
AnswerRe: Backup rows tables of SQL Server database by SMO base on colums's value Pin
Richard Deeming17-Dec-19 23:47
mveRichard Deeming17-Dec-19 23:47 
GeneralRe: Backup rows tables of SQL Server database by SMO base on colums's value Pin
Member 1417466417-Dec-19 23:57
Member 1417466417-Dec-19 23:57 
AnswerRe: Backup rows tables of SQL Server database by SMO base on colums's value Pin
David Mujica18-Dec-19 5:58
David Mujica18-Dec-19 5:58 
GeneralRe: Backup rows tables of SQL Server database by SMO base on colums's value Pin
Member 1417466418-Dec-19 14:35
Member 1417466418-Dec-19 14:35 
GeneralRe: Backup rows tables of SQL Server database by SMO base on colums's value Pin
David Mujica19-Dec-19 9:37
David Mujica19-Dec-19 9:37 
GeneralCode converter Pin
David Mujica19-Dec-19 9:47
David Mujica19-Dec-19 9:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.