?
Solved

SELECT statement

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

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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
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 70

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 34

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

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 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