User Profile
Collapse
-
With a little tweeking of the (), this works PERFECT. Thanks so much! -
Problems with using Variables in place of Nested Queires
Ok, I had a problem yesterday where the code was erroring out before running. Now it looks like I am presented with some logic errors that may be because of how I have implemented the variables.
Right now the below code runs, but it does not affect any codes "(0 row(s) affected)". I have been able to pull up over 500 rows that the code should affect. I think their may be a fundimental problem with the code below because if... -
ok, I was setting the variables early- I think... (it now works, but now 0 rows are affected- may be a logical operator)
The code needs to appear as follows:
DECLARE @q4TotRebate int, @sumRebate int, @q4TotRed int, @sumRedeemed int
Update tblTransactionS ummary
Set TotalRebate =
CASE
WHEN ((@q4TotRebate + @sumRebate)-(@q4TotRed + @sumRedeemed)) < 0
...Leave a comment:
-
This is great, Thanks!
The only problem I am now having (and I had before) is where do I place the "FROM tblTransactionS ummary as t" statement? I need to make sure that the account numbers used in the child queries "b, m, n, r" match that of the parent query "t".
Normally the FROM statement goes after the SELECT (or in this case SET) statement. But if I put it at the end, then in initiallizing...Leave a comment:
-
Using Variables inplace of nested Queries
Hi Gang
I am working on fixing a corrupted database (A yearly proc did not handel the conversion from year to year and now I have to fix the resulting lines in the DB). Most of my fixes I have been able to adjust with simply SET statements or nested queries. To fix one field I need to either make a very complex nested query or find a way to set variables to queries. But first I have to check to confirm that each query is not null.... -
Limitting by data type Date
Hi guys
I have a report that I need to limit the results to being for the last month from when it is run.
In other words. If the report is run in September, then the report needs to get data from 8-1 to 8-31. Then when the report is run in October, the report needs to get data from 9-1 to 9-30.
How would I write this as a SQL statement? Or, do you have any links or tips on how to use the Date data function.... -
Easy cross referencing question
OK, I need to select RealName from tblUser where the userid on tblUser matches the approvedby on tblCutList
This is incredibly easy, but it keeps erroring out. Please help!!!
No activity results to display
Show More
Leave a comment: