Solved

SELECT statement

Posted on 2011-09-26
19
238 Views
Last Modified: 2012-05-12
How in one select statement can display the employee get salaries in Augest and who the employee in that list take salary in the previous 3 month
0
Comment
Question by:egovernment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
  • +2
19 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36598357
Your question is a little hard to follow...

Can you post some sample data, and show what your expected results are?
0
 
LVL 33

Expert Comment

by:Norie
ID: 36598401
Do you mean employees who took a salary in August and also took a salary in the 3 months previous to that?

Which could meant took salary in May, June , July and August?
0
 

Author Comment

by:egovernment
ID: 36598424
Do you mean employees who took a salary in August and also took a salary in the 3 months previous to that?

Yes
0
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 
LVL 61

Expert Comment

by:mbizup
ID: 36598508
What are the fieldnames in your table?
0
 

Author Comment

by:egovernment
ID: 36598539
What are the fieldnames in your table?

Emp_Id
Emp_Name
From_Date
To_Date
Salary_Amount
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36598569
This might work for you:

SELECT * FROM YourTable
WHERE (Month(From_Date) + 3 >= Month(Now()) AND Year(From_Date) = Year(Now()))
OR (Month(To_Date) + 3 >= Month(Now()) AND Year(To_Date) = Year(Now()))
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 36598681
Or this:

SELECT * FROM YourTable
WHERE Datediff("M", [From_Date],Now()) <= 3 OR Datediff("M", [To_Date],Now()) <= 3
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 36598932
your request is ambiguous and requires clarification....

what is your table representing?
what do you mean by take salary?  (do you mean have been employed for at least 3 months ...?)

to answer you query requires either a Join or a subquery...

e.g.

select .... -- the information on employees "paid" in August
       ,(select 'Yes' .....
            from someofyourtables as a where a.employeeid=x.employeeid
                     )  a subquery to answer the "take salary 3 months" question
from yourtable as x
where ....
0
 

Author Comment

by:egovernment
ID: 36983836
I will review the all answers
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 37197545
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 

Author Comment

by:egovernment
ID: 37197546
There no correct ansewr
0
 

Author Comment

by:egovernment
ID: 37225048
I've requested that this question be deleted for the following reason:

There no correct answer
0
 

Author Comment

by:egovernment
ID: 37197551
There no correct answer
0
 
LVL 33

Expert Comment

by:Norie
ID: 37197563
There was no response from the questioner for 3 weeks.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37200248
egovernment,

What were the actual results when you tried our suggestions, and how did they differ from what you needed?
0
 

Author Comment

by:egovernment
ID: 37209089
Thanks for all

I don't need the answer for this question
0
 

Author Comment

by:egovernment
ID: 37225049
Ok

The correct answer is mbizup
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question