| Author |
Topic |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-03-30 : 09:33:43
|
| If I had the following, how would I get distinct records?create table test (a int, names varchar(20) descrip ntext, img image)1, blah, blahblah, <an image>1, blah, blahblah, <an image>2, blah2, blahblah, <2nd image>I ask as I have a similar situation, but with more records and I need to get distinct records and insert these into anoher table.. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-30 : 09:35:38
|
| Select Distinct * from yourTable?Can you post expected result?MadhivananFailing to plan is Planning to fail |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-03-30 : 09:39:32
|
| No, that won't work as distinct can't be used with ntext or image types, that's why i'm asking.. I would have thoguht the result set was fairly obvious, I want it to be distinct, so I want..1, blah, blahblah, <an image>2, blah2, blahblah, <2nd image> |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-03-30 : 10:02:11
|
| Don't worry, I sorted it by using a temp table.. |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-30 : 10:07:23
|
RICK,Can you please let us know how you did that?I came across with the following (I couldn't do it with Image Data Type)Create table #t (a int, n varchar(20), d ntext)Insert into #t values(1,'abc', 'pqr')Insert into #t values(1,'abc', 'pqr')Insert into #t values(2,'pqr', 'XYZ')Insert into #t values(3,'pqr', 'pqr')Select a,n,convert(varchar(8000),d) from #t group by a,n,convert(varchar(8000),d)drop table #t If used with image datatype, can that be converted to varbinary or some such and do the same as above ?Srinika |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-03-30 : 11:46:12
|
| No, I just selected distinct without the image or ntext, then joined back to the table with a not in clause as the images and ntext are the same for the same id's.. |
 |
|
|
|
|
|