473,480 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sql Server-Duplicate records

71 New Member
Hi all,

Im having problem and im spending half of the time for this. I have a databse for sms chat service. and a table containing the details such as mobileno,message,language,place,category,date,year .In this table i have a huge number of records. Now the problem is that i need to sort my table. I need the result in the same format(mobileno,message,language,...).And no duplication for mobileno.

Same mobileno will send more than one message.But i need only unique mobileno.In this situtaion what query can i give. I tried with some select query but all are giving the duplication of mobileno.

Pls help if anyone knows abt this.

Thanks in advance.

Jeen
Oct 29 '07 #1
4 1357
azimmer
200 Recognized Expert New Member
Hi all,

Im having problem and im spending half of the time for this. I have a databse for sms chat service. and a table containing the details such as mobileno,message,language,place,category,date,year .In this table i have a huge number of records. Now the problem is that i need to sort my table. I need the result in the same format(mobileno,message,language,...).And no duplication for mobileno.

Same mobileno will send more than one message.But i need only unique mobileno.In this situtaion what query can i give. I tried with some select query but all are giving the duplication of mobileno.

Pls help if anyone knows abt this.

Thanks in advance.

Jeen
Do you want the unique mobile numbers only (i.e. ones that show up exactly once in your table), or do you want to do something with the duplicated ones (e.g. show the first or last record)?

One solution to the first goes along the following pattern:
Expand|Select|Wrap|Line Numbers
  1. select y.mobileno,y.message,y.language,y.place,y.category,y.date,y.year
  2. from yourTable as y INNER JOIN
  3.  (select mobileno, count(mobileno)
  4.   from yourTable
  5.   having count(mobileno)=1) as x ON y.mobileno=x.mobileno
  6. order by y.mobileno,y.message,y.language,y.place,y.category,y.date,y.year
  7.  
Oct 30 '07 #2
jeenajos
71 New Member
Hi,
The duplication is for my mobileno.Some times date and year too bw duplicated.
In the same day itself one can send has many sms as they want. But i want a record in which any one of there message is present.
I need it in the above format itself.Not the mobileno or message alone.

I wil give an eg:
No Mess Date Year
1234 Hi 10Aug 2007
5487 Hi 22Aug 2007
1234 He 22Aug 2006

In this case the result shuld be like

1234 ---- ----- -----
5487 Hi 22Aug 2007

Any one record of No 1234.

Hope u can help me.
Thanks in advance

Regards
Jeen
Oct 31 '07 #3
azimmer
200 Recognized Expert New Member
Hi,
The duplication is for my mobileno.Some times date and year too bw duplicated.
In the same day itself one can send has many sms as they want. But i want a record in which any one of there message is present.
I need it in the above format itself.Not the mobileno or message alone.

I wil give an eg:
No Mess Date Year
1234 Hi 10Aug 2007
5487 Hi 22Aug 2007
1234 He 22Aug 2006

In this case the result shuld be like

1234 ---- ----- -----
5487 Hi 22Aug 2007

Any one record of No 1234.

Hope u can help me.
Thanks in advance

Regards
Jeen
The code in my previous post should be almost OK except that it omits all duplicate mobileno-s. The one that meets your format in the post (i.e. the one with dashes) is as follows:
Expand|Select|Wrap|Line Numbers
  1. select *
  2. from
  3. (
  4. select y.mobileno,y.message,y.language,y.place,y.category,y.date,y.year
  5. from yourTable as y INNER JOIN
  6.  (select mobileno, count(mobileno)
  7.   from yourTable
  8.   having count(mobileno)=1) as x ON y.mobileno=x.mobileno
  9. union
  10. select z.mobileno, '-----' as z.message,'-----' as z.language,'-----' as z.place,'-----' as z.category,'-----' as z.date,'-----' as z.year
  11. from yourTable as z INNER JOIN
  12.  (select mobileno, count(mobileno)
  13.   from yourTable
  14.   having count(mobileno)>1) as xx ON z.mobileno=xx.mobileno
  15. )
  16. order by mobileno
  17.  
Hope it helps.
Oct 31 '07 #4
jeenajos
71 New Member
Hi..
Thank u for the solution.
But in this situation im having about 2 crores of records.I cant specifically write the message or date.In ur previous query u had used union and al.But the ---- means i want to sort the message according to the messages or date or year know..Its huge record that i cant give one by one

Hope u get me.
Thank U.
Regards
Jeen
Oct 31 '07 #5

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

Similar topics

2
4548
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
4433
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
669
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
2790
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
4505
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
2
8372
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
4898
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
2
6914
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
14
2997
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
7046
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
6908
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
7088
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...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5342
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
4485
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...
0
2997
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.