[Solved] Need query to start at the beginning of the month

[ad_1] You could calculate the 1st of the month using EOMONTH something like this SELECT DISTINCT ATB.AcountCountDesc,TB.LastFirstName,N.EMAIL,TB.AccountNumber,TB.OpenShareCount,TB.MemberOpenDate, TB.OpenMemberCount,TB.OpenShareBalance,SH.ShareType,FORMAT(SH.ShareOpenDate,’MM/dd/yyyy’) AS “ShareOpenDate”, SH.ShareCreatedByUser,SH.ShareCreatedByUserName,SH.ShareBranchName,SH.ShareBranch,cast(month(SH.ShareOpenDate) as varchar) + “https://stackoverflow.com/” + cast(year(SH.ShareOpenDate) as varchar)as ‘Open Period’, CONCAT(SH.ShareCreatedByUser,’-‘,SH.ShareCreatedByUserName) ‘Opened By’ FROM arcu.vwARCUOperationMemberTrialBalance as TB JOIN arcu.vwARCUOperationMemberAccountTrialBalance as ATB ON TB.MemberSuppID = ATB.MemberID and TB.ProcessDate = ATB.PDate and TB.MemberStatus = 0 — … Read more

[Solved] Which SQL platform is this code?

[ad_1] Well, it really seems to be MS SQL Server: Use a Format File to Bulk Import Data (SQL Server) Example says: USE TestDatabase; GO TRUNCATE TABLE myFirstImport; — (for testing) BULK INSERT dbo.myFirstImport FROM ‘D:\BCP\myFirstImport.bcp’ WITH (FORMATFILE = ‘D:\BCP\myFirstImport.xml’); GO which is really close to what you have. [ad_2] solved Which SQL platform is … Read more

[Solved] How to get Previous December month of Previous Year

[ad_1] are you looking for something like this SELECT extract(year_month from DATE_ADD(curdate(),INTERVAL -1 YEAR)); another example where adding 13 months SELECT extract(year_month from DATE_ADD(curdate(),INTERVAL 13 MONTH)); 1 [ad_2] solved How to get Previous December month of Previous Year

[Solved] How to add values from a string in SQL Server 2008 using a stored procedure? [closed]

[ad_1] I have prepared a SQL script for you which splits the input string twice then converts is into row data, and finally inserts into a database table To split string data, I used this SQL split string function First of all, you need to create this function on your database. Unfortunately, if you do … Read more

[Solved] Formulate SQL query

[ad_1] After a while I got the right solution. The key was to use multiple selects and it worked like a charm. 0 [ad_2] solved Formulate SQL query

[Solved] SQL help on self Join query

[ad_1] Looks like you just need : SELECT p.paymentid, p.paymentdate, c1.name payment_customer, c2.name customer FROM payment p INNER JOIN customers c1 ON p.cust_id = c1.paymentcustid INNER JOIN customers c2 ON p.cust_id = c2.custid; 0 [ad_2] solved SQL help on self Join query

[Solved] SQL Query to Count total rows grouping different columns

[ad_1] There are 3 quite different methods needed to arrive at the counts, so I have used 3 separate sub-queries. see this working at sqlfiddle (but not on MS SQL Server) here: http://sqlfiddle.com/#!5/9df16/1 Result: | Total_Count | Repeat_Return | Same_Symptom_Return | |————-|—————|———————| | 6 | 2 | 1 | Query: select (select count(distinct SN + … Read more

[Solved] Syntax error. in query expression -Delphi

[ad_1] Give a try; Procedure TFNewCarAct.BtnSaveClick(Sender: TObject); begin adoQueryCCA.Close(); adoQueryCCA.SQL.Clear; adoQueryCCA.SQL.Add(‘INSERT INTO tblcaractivity ([CCarID],[Date],[Millage],[SerRcd],[EOType],[EOQunt],[AirFil],[GOil])’); adoQueryCCA.SQL.Add(‘VALUES(:CCarID,:Date,:Millage,:SerRcd,:EOType,:EOQunt,:AirFil,:GOil)’); adoQueryCCA.Parameters.ParamByName(‘CCarID’).Value:= Integer(ComboBox2.Items.Objects[ComboBox2.ItemIndex]); adoQueryCCA.Parameters.ParamByName(‘Date’).Value:= Edit6.Text; adoQueryCCA.Parameters.ParamByName(‘Millage’).Value:= Edit1.Text; adoQueryCCA.Parameters.ParamByName(‘SerRcd’).Value:= memo1.Text; adoQueryCCA.Parameters.ParamByName(‘EOType’).Value:= Edit2.Text; adoQueryCCA.Parameters.ParamByName(‘EOQunt’).Value:= Edit3.Text; adoQueryCCA.Parameters.ParamByName(‘AirFil’).Value:= Edit4.Text; adoQueryCCA.Parameters.ParamByName(‘GOil’).Value:= Edit5.Text; adoQueryCCA.ExecSQL; ShowMessage(‘Done’); end; procedure TFNewCarAct.FromShow(Sender: TObject); begin ADOQueryCT.Open; while Not ADOQueryCT.Eof do begin ComboBox1.Items.Add(ADOQueryCT.FieldByName(‘Name’).AsString); ADOQueryCT.Next; end; ADOQueryCT.Close; if ComboBox1.Items.Count > 0 then ComboBox1.ItemIndex := … Read more

[Solved] from keyword not found where expected in case statement

[ad_1] Looks like there is comma missing. Also you need to use the entire case statement in group by not the column name alone SELECT To_date(To_char(BATCH_CREATION_TIME,’YYYY/MM/DD’),’YYYY/MM/DD’) AS CREATION_DATE, Sum(Decode(CDR_ACTUAL_COUNT,NULL,0,CDR_ACTUAL_COUNT)) AS CCOLLECTED, Sum(Decode(CDR_ACTUAL_COUNT,NULL,0,CDR_ACTUAL_COUNT)) – Sum(Decode(CDR_PARSE_ERROR_COUNT,NULL,0,CDR_PARSE_ERROR_COUNT)) – Sum(Decode(CDR_DISCARD_COUNT,NULL,0,CDR_DISCARD_COUNT)) AS COLLECTED, Sum(Decode(VALIDATION_CNR_COUNT,NULL,0,VALIDATION_CNR_COUNT)) + Sum(Decode(VALIDATION_CE_COUNT,NULL,0,VALIDATION_CE_COUNT)) + Sum(Decode(VALIDATION_CR_COUNT,NULL,0,VALIDATION_CR_COUNT)) + Sum(Decode(VALIDATION_NCR_COUNT,NULL,0,VALIDATION_NCR_COUNT)) AS ERRORED, Sum(Decode(VALIDATION_RNC_COUNT,NULL,0,VALIDATION_RNC_COUNT)) + Sum(Decode(VALIDATION_RV_COUNT,NULL,0,VALIDATION_RV_COUNT)) AS PROCESSED , CASE WHEN … Read more

[Solved] Display sql database on webpage

[ad_1] First you have to put your resultset into a list of Objects. For example: ArrayList<Extcteach> extcteachList = new ArrayList<Extcteach>(); while(resultset .next()) { Extcteach extcteach = new Extcteach (); extcteach.setAttr1 = (result.getString(“column1”) extcteach.setAttr2 = (result.getString(“column2”) /****THIS FOR EACH COLUMN OF YOUR TABLE****/ extcteachList.put(extcteach) } Now you have a list of object so in your jsp … Read more