Question

  • Hello,

    My name is najibullah. I have table of salary of staff i want caculate the salary of staff every month and every year i don't know the query

    can i one help me in this query?

    thanks

    Najibullah Sherzad

  • not enough info;

    you have a table with salaries, what does it contain? do you mean a base rate of pay? is it an hourly rate, so $10 dollars an hour, x 40 hours a week, or is it actual salaries, how much they make per week [or pay period] regardless of hours worked? does it containt the pay period length as well?

    or does the table contain what they were actually paid previously, and you want to extrapolate?

    the rest of all the calculations, monthly vs yearly, is just multiplication, but we need the structure of the data to give you a meaningful answer.

    can you show us the CREATE TABLE statement, along with a couple of rows of INSERT INTO data of fake, example data?

    do not give us real data, don't get yourself in trouble posting salaries of your coworkers on the interwebs

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • one should know the business specifications or logic to implement the functionality of calculating the salary 😎

  • Hello lowel brother,

    My table stracture like that

    create table salary(id int(9), name char(23), fathername char(23),

    Salary number(12))

    thanks,

    Najibullah sherzad

  • Hello Najibullah,

    You say you want to calculate the amount by month and year. I don't see any columns in your salary table with a reference to year and month. Or are they stored in the integer field 'salary-id' , and if so how ?

    regards,

    Cees

  • najib_sherzadd (5/1/2010)


    Hello lowel brother,

    My table stracture like that

    create table salary(id int(9), name char(23), fathername char(23),

    Salary number(12))

    thanks,

    Najibullah sherzad

    OK Najibullah; i noticed the Salary is datatyped as number(12), so i assume you are using Oracle? won't make a difference here, but remember this is a SQL oreiented forum; a lot of answers might be work only in SQL.

    if that column has the weekly salary, why would it not be something as simple as this?

    SELECT

    ID,

    NAME,

    FATHERNAME,

    SALARY,

    SALARY * 4 AS MONTHLY_SALARY,

    SALARY * 52 AS YEARLY_SALARY

    FROM SALARY

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply