473,387 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Between operator

75
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT empno,sal,job 
  3.           FROM emp 
  4.           WHERE deptno IN (SELECT deptno FROM dept) AND
  5.            to_char(joindate ,'ddmmyyyy') BETWEEN 
  6.            (START_DATE)   AND (END_DATE);
  7.  
The above query will give me result set of employees who has joindate between startdate and enddate .
Now I wanted to Retrieve those employees whose joindate is not between startdate and enddate .
Could you Please tell me how to achieve the by using this query .

Thanks in advance .
Dec 31 '07 #1
2 1838
amitpatel66
2,367 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT empno,sal,job 
  3.           FROM emp 
  4.           WHERE deptno IN (SELECT deptno FROM dept) AND
  5.            to_char(joindate ,'ddmmyyyy') BETWEEN 
  6.            (START_DATE)   AND (END_DATE);
  7.  
The above query will give me result set of employees who has joindate between startdate and enddate .
Now I wanted to Retrieve those employees whose joindate is not between startdate and enddate .
Could you Please tell me how to achieve the by using this query .

Thanks in advance .
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT empno,sal,job 
  3.           FROM emp 
  4.           WHERE deptno IN (SELECT deptno FROM dept) AND
  5.            (to_char(joindate ,'ddmmyyyy') < (START_DATE)   OR to_char(joindate ,'ddmmyyyy') > (END_DATE));
  6.  
  7.  
Dec 31 '07 #2
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT empno,sal,job 
  3.           FROM emp 
  4.           WHERE deptno IN (SELECT deptno FROM dept) AND
  5.            to_char(joindate ,'ddmmyyyy') BETWEEN 
  6.            (START_DATE)   AND (END_DATE);
  7.  
The above query will give me result set of employees who has joindate between startdate and enddate .
Now I wanted to Retrieve those employees whose joindate is not between startdate and enddate .
Could you Please tell me how to achieve the by using this query .

Thanks in advance .


Simply use NOT BETWEEN instead of BETWEEN

That's it
Jan 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: BekTek | last post by:
Hi.. I'm so sorry about that I've postes so many questions recently.. :) I'm still confused about the differences between malloc and operator new.. I know that when we work with class object and...
6
by: Arne Schmitz | last post by:
I guess this has been asked before, but I cannot find any answer to this problem. I have program like this: ---SNIP--- #include <cassert> #include <cstdlib> class C { public:
4
by: Mark Reed | last post by:
Hi all, I have a query (query1) which shows scan date, scan time & operator. One scan = 1 record. What I want to do is create a report based on query 2 from query1 which shows all the scans AND...
26
by: Gary Wessle | last post by:
Hi I need help to generate some random numbers between 2 and 8. #include <cstdlib> using std::rand; the following was out of my range, int main() {
2
by: Eric Lilja | last post by:
I'm looking at an assignment where the students are expected to write a class with a given purpose. According to the assignment, you should be able to do this with instances of the class:...
7
by: Alex Vinokur | last post by:
What is the difference between an operator and a function in C++? Alex Vinokur email: alex DOT vinokur AT gmail DOT com http://mathforum.org/library/view/10978.html...
11
by: blangela | last post by:
I am teaching a C programming course to C++ programmers and want to come up with list of _KEY_ differences between the two languages. Below is a list I have come up with so far. Have I missed any?...
3
by: Aarti | last post by:
Hi, Why does void* p = new (1024); gives me a compilation error while void* p = operator new (1024); works. What is the difference between new and "operator new"? Please help. Regards,
4
by: DBC User | last post by:
This is a very simple question, I have a number and I want to check if the number is between 2 integers. I can use 'if' to resolve this situation. But I am curious, if there is any other verbs that...
8
lotus18
by: lotus18 | last post by:
Hello World! I know that The BETWEEN ... AND operator selects a range of data between two values and I found article about this operator that it is treated differently in different databases....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.