Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
R@bb1t
Starting Member
28 Posts |
Posted - 2008-01-18 : 02:21:47
|
Hi, I would like to know how can you select unique firstname, lastname from a table... that is eliminating duplicate rows. distinct does not work... please help |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-18 : 03:03:36
|
Do you get any errors using DISTINCT?Please provide some proper sample data and your expected output.Also post information why you think DISTINCT do not work. E 12°55'05.25"N 56°04'39.16" |
|
|
R@bb1t
Starting Member
28 Posts |
Posted - 2008-01-18 : 03:34:31
|
The select statement is as follows:SELECT FirstName, LastName FROM Members_ProfileUNIONSELECT FirstName, LastName FROM NewsletterHow can I eliminate duplicate rows... Yes, distinct cannot work here!! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-18 : 03:45:47
|
by duplicate, do you mean the combination of firstname and lastname should be different?As said, post some sample data with expected resultMadhivananFailing to plan is Planning to fail |
|
|
sunil
Constraint Violating Yak Guru
282 Posts |
Posted - 2008-01-18 : 03:50:45
|
If I have got your problem correctly you are trying some things sort of given below:create table #Name( firstname varchar(30), lastname varchar(30))GOcreate table #News( firstname varchar(30), lastname varchar(30))GOinsert into #Name values ('vishal','sharma')insert into #Name values ('Varun','singh')insert into #Name values ('sunil','kumar')insert into #News values ('vishal','sharma')insert into #News values ('Varun','singh')insert into #News values ('sunil','kumar')insert into #News values ('pankaj','jain')insert into #News values ('neeraj','anand')select firstname,lastname from #NameUnionselect firstname,lastname from #News It is not giving duplicate result. |
|
|
|
|
|
|
|