I am going to be crazy I think. Please Help.
I have a table which fields are Date, No, Turnover, TotalWin, Opencredit, Handpay, Billin, gamesplayed and I am trying to write sql in vb.net that will show me previous day value but I cant. Here is what I am trying to do.
SELECT Meter.*
FROM
Meter AS Previous,
Turnover As Prev_turnover
WHERE Date = '
SELECT Max(Date)
FROM Meter AS Previous2
WHERE Previous2.Date < Date
AND Previous2.No = ‘No'
AND Previous.No = ‘No’
What is wrong in where I am doing mistake I really don’t know. If anyone help will be appreciated.
Thanks
Ok Thomas I am not able to give correct answer to your question because first time in my Life I am trying to write sql. I was doing this with MSAccess and it was easy. Now I am getting pretty simple error I think with this code but I can’t find solution again. What is wrong.
SELECT [Date], [No], Turnover, TotalWin, GamesPlayed, CreditIn, BillIn, HandPay
FROM Meter As Previous,
Turnover As Prev_turnover WHERE [Date] = ‘SELECT Max([Date]) FROM Meter As Previous2 WHERE Previous2.[Date]<[Date] AND Previous.[No]=[No]’
So what about this error “No value given for one or more required parameters”
Now I am with that code:
SELECT Meter.[Date], Meter.[No], Meter.Turnover, Meter.TotalWin, Meter.GamesPlayed, Meter.CreditIn, Meter.BillIn, Meter.HandPay
FROM Meter As Previous,
Turnover As Prev_turnover WHERE Meter.[Date] = ‘SELECT Max(Meter.[Date]) FROM Meter As Previous2 WHERE Previous2.[Date]
I found answer
FROM tblMeter
WHERE (Date >= DATEADD(day, DATEDIFF(day, 1, GETDATE()), 0)) AND (Date < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0))
Thaks to everyone who try to help me.