Hi sabinUE,
I think I've found out why it was showing two results.
From the 13/12/2013, the naming of the suppliers changed from Berkana Park to Berkana Park 1 and Berkana Park 2, so when the LEFT(t0.SupplierName,LEN(t0.SupplierName)-2) is taking place after the union all, it shows as...
Hi sabinUE,
Thanks for that, I have added the extra columns as you suggested and I'm getting these results:
Farm Dscription EggPercent express
Berkana Park 55 9.9413602235984 1
Berkana Park Blood 0 1
Berkana Park Crack 3.44531521163296 1
Berkana Park Dirt 6.30057909062677 1
Berkana Park Jumbo...
Hi sabinUE
Please find the code below:
declare @FromDate as DATE
,@ToDate as DATE
SET @FromDate=CONVERT(date, DATEADD(d,-7,getdate()))
SET @ToDate=CONVERT(date, getdate())
select (case when SupplierName = 'Cage' then 'Cage' else LEFT(t0.SupplierName,LEN(t0.SupplierName)-2) end) As Farm...
Hi sabinUE,
I've made some adjustments to the query where I am only looking at Berkana Park for now and I'm getting the actual results for the last week but also I am receiving the 1 Eggpercent as below:
Farm Dscription EggPercent
Berkana Park 55 9.9413602235984
Berkana Park Blood 0
Berkana...
Hi SabinUE,
Thanks for the help, I've changed the query to look at my view but it also seems to pick up the other farms (example Kerr Farm)?
Do I change the first select statement after the Union All to only look for Berkana?
select SupplierName,Dscription,EggPercent--,FirstDate
from Farm...
Hi SabineUE,
I've run the query and that's perfect.
I'm presuming I would only need this section for the view (and replace Farm with the name of the view?):
select SupplierName,Dscription,EggPercent--,FirstDate
from Farm as t0
where t0.FirstDate >= @FromDate and t0.FirstDate <= @ToDate AND...
Hi SabinUE,
Thanks for the quick response. Would that still be okay if there is no data for the farm itself?
To clarify, the view's data is filled out when the eggs from a farm are graded (suppliername, date etc.) for a date. If no eggs are graded for that farm, the SupplierName, Date etc. is...
Hi all,
We are using Microsoft SQL Server 2008 and are querying a SQL view that contains information about our egg grade percentages for each farm.
A manager wants as part of the query if a farm does not exist for the last seven days then it is it return a default percentage of one for the...
Thanks Madawc, sorry about that. We are indeed using Crystal Reports 2008.
Several of the rows are formula based (calculating percentages, differences etc).
I am struggling to come up with a formula that contains the right logic to perform this calculation.
I made a formula using an if then...
Hi all,
We are trying to come up with a forecast report and are trying to calculate the opportunity cost. We have created a formula - ABS(IF(D22<0),(-D22-E22)) - in Excel where this is basically saying if the net quantity difference between the forecast, actual and sales for the second most...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.