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
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: -
select y.mobileno,y.message,y.language,y.place,y.category,y.date,y.year
-
from yourTable as y INNER JOIN
-
(select mobileno, count(mobileno)
-
from yourTable
-
having count(mobileno)=1) as x ON y.mobileno=x.mobileno
-
order by y.mobileno,y.message,y.language,y.place,y.category,y.date,y.year
-
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
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: -
select *
-
from
-
(
-
select y.mobileno,y.message,y.language,y.place,y.category,y.date,y.year
-
from yourTable as y INNER JOIN
-
(select mobileno, count(mobileno)
-
from yourTable
-
having count(mobileno)=1) as x ON y.mobileno=x.mobileno
-
union
-
select z.mobileno, '-----' as z.message,'-----' as z.language,'-----' as z.place,'-----' as z.category,'-----' as z.date,'-----' as z.year
-
from yourTable as z INNER JOIN
-
(select mobileno, count(mobileno)
-
from yourTable
-
having count(mobileno)>1) as xx ON z.mobileno=xx.mobileno
-
)
-
order by mobileno
-
Hope it helps.
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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"...
|
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...
|
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...
|
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:
...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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...
|
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...
|
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,...
|
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: 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...
|
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 ...
| |
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...
| |