473,410 Members | 1,904 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,410 software developers and data experts.

intersection data in MS SQL 2000 server

zybernau
Hi All,

i am using Sql Server 2000,
i am having table table1 which have columns field1 , date1
which can have data like this [sample]

field1 date1
12 2007-12-25
12 2007-12-26
12 2007-12-27
12 2007-12-28
13 2007-12-25
13 2008-01-25
14 2007-12-25
14 2008-01-15
15 2008-01-15
15 2008-01-15
15 2008-01-15

i will be having data across years for the same field1
i need to take only those records which have records on the both year [2008 and 2007]

i tried using intersect , but its not working in sql server 2000

Thanks
-Raj
Jan 17 '08 #1
1 1745
ck9663
2,878 Expert 2GB
Hi All,

i am using Sql Server 2000,
i am having table table1 which have columns field1 , date1
which can have data like this [sample]

field1 date1
12 2007-12-25
12 2007-12-26
12 2007-12-27
12 2007-12-28
13 2007-12-25
13 2008-01-25
14 2007-12-25
14 2008-01-15
15 2008-01-15
15 2008-01-15
15 2008-01-15

i will be having data across years for the same field1
i need to take only those records which have records on the both year [2008 and 2007]

i tried using intersect , but its not working in sql server 2000

Thanks
-Raj

try:

select * from yourtable where datepart(year, date1) between 2008 and 2007

or


select * from yourtable where datepart(year, date1) in (2008, 2007)


happy coding...


--- CK
Jan 17 '08 #2

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

Similar topics

5
by: Antoine Logean | last post by:
Hi, What is the easiest way to get the intersection of two strings in python (a kind a "and" operator) ? ex: string_1 =...
17
by: Gordon Williams | last post by:
Hi, I have to lists that I need to find the common numbers (2nd rounded to nearest integral) and I am wondering if there is a more efficient way of doing it. >>> a= >>> b= >>> ...
2
by: Serdar Yegulalp | last post by:
I'm in the process of migrating a lot of data (millions of rows, 4GB+ of data) from an older SQL Server 7.0 database to a new SQL Server 2000 machine. Time is not of the essence; my main concern...
7
by: Will | last post by:
I'm trying to build dynamic sql from a string passed by a calling application. Let's assume for this discussion that the user can pass a string of letters with these logical operators ("and",...
6
by: micmic.chion | last post by:
I am using Windows 2003 Server English Version. I wanna store the big-5 data so I install the sql server 2000 as if i install it in the Windows 2000 with Server Collation of the...
4
by: Sebastian Cohen S | last post by:
Hello, I am new to SQL and currently using Access 2003 and need a little help on the following. I have two queries each contains one column formed with a string that is very similar (only...
6
by: kimos | last post by:
hi all, how to calculate the intersection of 2 rectangle a rectangle is the following: Rectangle makeRectangle (Point lowerLeft, Point upperRight) { Rectangle r;
2
by: mkppk | last post by:
I have kind of strange change I'd like to make to the sets.Set() intersection() method.. Normally, intersection would return items in both s1 and s2 like with something like this: ...
11
by: Prateek | last post by:
I have 3 variable length lists of sets. I need to find the common elements in each list (across sets) really really quickly. Here is some sample code: # Doesn't make sense to union the sets -...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.