Here is what I used to update the Cancelled flag when there orders that were cancelled and not re-billed (count is an even number):
UPDATE Orders
SET o.Cancelled = 1
FROM Orders o INNER JOIN (SELECT a.Order_ID, convert(int,right(a.Order_ID,2)) as Order_End, case when (x.Count % 2) = 0 then 0...
Hello,
I needed some help on how to set records that where cancelled. Here is the table (Orders) and the relevant fields:
Orders
Order_ID (VARCHAR(25))[/*]Cancelled (BIT)[/*]
Using the Order_ID, what I need to do is to find any orders that were cancelled and its corresponding original...
Hello JarlH,
Thanks for your reply. Let's just say I need the firm_code and the firm_id. Since I have not done triggers, would it be possible to show how the sql syntax look like? Also, would two triggers work in this situation? Since firm_id in the offices table is NOT NULL, I'm not sure...
Hello,
I wanted to know what would be the best way to update a field of a row while I am inserting. Here are the tables and fields (for simplicity I am only including relevant fields):
• firms
⁃ firm_id (integer, autoincrement, primary key)
⁃ firm_code (varchar(25), internal code)
⁃ name...
JarlH, thank you very much! The first method worked beautifully!
Although, when I tried the second method, it just returned the very large number and did not provide the expected results. Any how, I am grateful for your assistance on resolving this issue.
Thanks.
JarlH, thank you for replying. I tried both ways; however, it id not produce the desired results. If I remove the "else 0," the results returns null not the expected values. Also, I tried "MAXINT." Although, in Sybase (which I am using), does not support MAXINT. Any other thoughts is...
Hello,
I am trying to generate a summary report using various aggregate functions: MIN, MAX, SUM, etc. The issue I have is when I try to get a MIN and MAX of a field when I am also using the case statement. I am unable to get the MIN value of a field when I am using the case statement. I...
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.