Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SELECT statement

Posted on 2011-09-26
19
Medium Priority
?
256 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 35

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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 71

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 35

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

610 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