sql with employer table? salary and advance_payment [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.
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

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.

What Does the SQL dash character do? [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.
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

how do i display the sum of a SQL query in HTML? [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 tried to do this:
SELECT SUM(SUBTOTAL as TODAYSALES) FROM dbo.SALESORD_HDR where ORDERDATE >=41187
But the browser throws an exception about the sum function saying 'SUM' is not a recognized built-in function name.
Any ideas?
Doing a
SELECT SUM(SUBTOTAL) as TODAYSALES FROM ...
would work a lot better.
Your syntax seems off. It should be SELECT SUM(SUBTOTAL) AS TODAYSALES FROM dbo.SALESORD_HDR where ORDERDATE >= 41187
Aliases must be defined outside the expression they are targeting:
SELECT SUM(SUBTOTAL) as TODAYSALES FROM dbo.SALESORD_HDR where ORDERDATE >=41187

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())

SQL: nobel prize table on sqlzoo [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 11 years ago.
I am learning SQL and do some practice on the internet.
I cannot find the answer for the problem 4a and 4b on http://sqlzoo.net/2b.htm
The table's name is nobel and have 3 colums (yr, subject, winner)
The question is:
Show the years in which three prizes were given for Physics.
Show winners who have won more than once.
Thanks
This should do it for 4a:
SELECT yr
FROM nobel
WHERE subject = 'Physics'
GROUP BY yr
HAVING COUNT(*) = 3;
And for 4b:
SELECT winner
FROM nobel
GROUP BY winner
HAVING COUNT(*) > 1;