Viewing 15 posts - 76 through 90 (of 92 total)
just test code tags
Select FSA3.CustAccount,CT1.WIKA_DUNBRAD, Sum(FSA3.LineAmount)AS Last12MonthsSalesAmt,FSA3.ITEMID,x.FirstSaleDateinLast12Months,'NewCustomer' AS Status
From (
Select Cast (getdate() AS DATE) AS SnapShotDateCustaccount,FSA1.CUSTACCOUNT,sum(FSA1.lineamount) AS AmtLocalCurrency,sum(FSA1.lineamount) AS AmtUSD,min(FSA1.invoicedate) AS FirstSaleDateinLast12Months,DATEADD(mm, DATEDIFF(mm, 0, DATEADD(DAY, -(DAY(GETDATE())), GETDATE())) - 11, 0)...
April 21, 2016 at 7:46 am
just a test of the tags
code=SQL
Select FSA3.CustAccount,CT1.WIKA_DUNBRAD, Sum(FSA3.LineAmount)AS Last12MonthsSalesAmt,FSA3.ITEMID,x.FirstSaleDateinLast12Months,'NewCustomer' AS Status
From (
Select Cast (getdate() AS DATE) AS SnapShotDateCustaccount,FSA1.CUSTACCOUNT,sum(FSA1.lineamount) AS AmtLocalCurrency,sum(FSA1.lineamount) AS AmtUSD,min(FSA1.invoicedate) AS FirstSaleDateinLast12Months,DATEADD(mm, DATEDIFF(mm, 0, DATEADD(DAY, -(DAY(GETDATE())), GETDATE())) -...
April 21, 2016 at 7:43 am
got it thanks, I will post here to practice, Again many thanks
April 21, 2016 at 7:24 am
so yes that worked, and as you noted so much simpler than my solution. I will "reverse engineer' you SQL statement to understand how it is working.
Not...
April 21, 2016 at 6:42 am
A couple things.
1) The posted script for creating the data won't parse (a typo in "integer" and no commas separating the VALUES for the first INSERT).
2) Both the total...
April 20, 2016 at 4:57 pm
this is the full code. it is now working, but for existingvehicles it brings back multiple dates and I only want the earliest date (like new vehicles) In...
April 20, 2016 at 4:04 pm
ok so I understand how to do this better. I have two tables. vehiclemaintenance and vehicle table
this is the data for vehiclemaintenance
Create Table VehicleMaintenance(
Unitid interger not null
,servicedate datetime not...
April 20, 2016 at 3:59 pm
actually I am going to repost the data again. because I did not do it correctly the first person to help just used consecutive dates. that will not...
April 20, 2016 at 3:31 pm
yes thank you for your help, I now understand how to post a question in the correct format so someone can create the necessary tables quickly and easily and then...
April 20, 2016 at 2:31 pm
I understand, I will test it, thank you.
April 20, 2016 at 1:26 pm
Ok Yes, your table create and insert statements are exactly correct.
sorry missed the comment about the vehicle table.
CREATE TABLE VehicleTable( unitid INTEGER NOT NULL ,vehiclename VARCHAR(13) NOT NULL...
April 20, 2016 at 12:22 pm
ok, good points let me try this
I know my code is complex, this is probably the most complex task I have tried. Basically I wrote the code using a...
April 20, 2016 at 12:00 pm
I attached a word document with my SQL code and an excel file with table data and expected results? When I say the pieces run, I mean if I...
April 20, 2016 at 8:32 am
worked perfectly thank you. got 351 individual rows instead of 1 single row. I will compare to my original code, see your changes, and learn something new :-)...
November 19, 2015 at 2:34 pm
not sure I am technical enough to explain it correctly, but as it was explained to me, the ISNULL answer takes on the attributes of the original field. In...
September 23, 2015 at 1:09 pm
Viewing 15 posts - 76 through 90 (of 92 total)