April 1, 2011 at 1:12 am
i Need to get odd data based on ContactID
table contains more than 10000 records
table has 9 columns
FirstName
MiddleName
LastName
Address1
Address2
City
State
Country
ContactId
April 1, 2011 at 1:17 am
What according to you is odd data? provide sample data, sample table structure as CREATE TABLE script and most importantly, your expected output..
April 1, 2011 at 1:40 am
Please find the table structure as below
CREATE TABLE Contact
(
FirstName varchar(100),
MiddleName varchar(100),
LastName varchar(100),
ContactId int,
CONSTRAINT pk_Contact_pid PRIMARY KEY(ContactID)
)
April 1, 2011 at 1:50 am
Hi,
Please provide sample data.
April 1, 2011 at 1:51 am
this is not enuf.. We need sample data and expected output.. and your business process to arrive at the expected output..
April 1, 2011 at 3:06 am
Assuming by "odd data" you mean "rows where the value of contactid is an odd number" then something like
select ...
where contactid % 2 = 1
Should do the trick. This will however always result in a table scan - but as it likely that you will return 50% of the rows from the table that is probably to be expected.
Mike
April 1, 2011 at 3:29 am
I got it solved thanks a lot guys
April 1, 2011 at 3:54 am
Praveen, Did you use Mike's solution? Is that what you were looiking for?
_____________________________________________
One ounce of practice is more important than tonnes of dreams
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply