What Does the SQL dash character do? [closed] - sql

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
In a SQL statement I am debugging, I found a - used in a way I don't recognize:
it appears in this SELECT statement between "Book_Balance" and "Participation_Lookups"
SELECT "LNIMPR"."Book_Balance" - "Participation_Lookups"."Participation Principal Assets" AS "C7"
FROM ...
What does the - do in the above context?

It is subtracting the two columns.
They must both be numeric values and in SQL to subtract you use the minus sign -.
If Book_balance is 100 and Participation Principal Assets is 25, then is it basically saying:
select 100 -25 as C7
from ...
This calculation is occurring for each row that is returned.

Numeric subtraction, as in 10 - 4 = 6

Related

Double Record on itab [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have problem,
I have 1 itab like this
Do.No. Material Amount
10001 AAA 25000
10001 AAA 25000
10002 AAA 25000
My quest is How I can Replace Second record (10001) with third record (10002).
Thank For you Help
Use DELETE ADJACENT DUPLICATES.

sql with employer table? salary and advance_payment [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How to get this payment?
employer_payment.payment = employer_salary.salary - employer_advance_payment.advance_payment
Please give me your suggestions on the question how I solve this problem?
you can use LEFT JOIN to be able to calculate the salary deducted by the advance_payment.
SELECT a.employerID,
a.salary - COALESCE(b.advance_payment, 0) payment
FROM employer_salary a
LEFT JOIN employer_advance_payment b
ON a.employerID = b.employerID

sql with an array [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Can this loop be done in sql ?
Dim ID(0 TO 2) as string
Dim number as string
ID="01"
ID="02"
For each number in ID
SELECT data FROM sheet1 WHERE data= number
next number
datatable:
data
01
01
02
03
04
This can be done using the IN predicate:
SELECT data FROM sheet1 WHERE data IN(1, 2);

SQL Update Column [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How do I grab the last character of a column and convert it to a number? Example: Column000000000017A000000000038B000000000431CNeed to change the last letter to the following if letter equals to:A=1B= 2C=3Results:1713824313
The ASCII value of A is 65. So you can translate C to 3 by subtracting 64 from its ASCII value.
select cast(
left(col1, len(col1) - 1) +
cast(ascii(upper(right(col1, 1))) - 64 as char(1))
as int)
from Table1
Live example at SQL Fiddle.
i think you need to use REPLACE function of SQL
http://msdn.microsoft.com/en-en/library/ms186862.aspx
Figured it out with the following SQL Statement. To change multiple criteria replace in one column, I used:
SELECT REPLACE(REPLACE(REPLACE(Prev_Month_Vol,'A','1'), 'B', '2'), 'C', '3')
FROM table1
Hope this helps out someone looking to do replace statements.

How do I add hours to the result of SQL Server's `GetDate()` function? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to add 2 hours to the result of getdate() in SQL SERVER. I know that I can add one day with:
select getdate() + 1
But how is this done when wanting to add on hours onto getdate()?
select dateadd(hour,2,getdate())
Select GETDATE() + (Convert(float,2)/Convert(float,24))
OR in other way
Select DateAdd(HH,2,Getdate())