473,506 Members | 14,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

matching same words only once

Greetings to all from the corner or Asia - guess where Iran!
Going directly to the point, I need to know how can we match a
pattern only once.
"SELECT exp01 FROM tblExp01 " will give me all the occurences of
exp01, my question is how can we see only non repeated occurences.
Example:
SELECT exp01 FROM tblExp01;

output of above query:
name1
name2
name1
name1
name2
name1
name3

I just want to see an output like:

name1
name2
name3

That there is an occurence, then select it, but if there was an
accurence donot select it again.

I hope I am not confusing you all , because I am not too good at
mySQL.
Thanks everyone.
ghasem
Jul 20 '05 #1
5 1286

SELECT DISTINCT exp01 FROM tblExp01;
http://dev.mysql.com/doc/mysql/en/SELECT.html
On 10 Aug 2004 05:10:21 -0700, gh************@yahoo.com (ghasem) wrote:
Greetings to all from the corner or Asia - guess where Iran!
Going directly to the point, I need to know how can we match a
pattern only once.
"SELECT exp01 FROM tblExp01 " will give me all the occurences of
exp01, my question is how can we see only non repeated occurences.
Example:
SELECT exp01 FROM tblExp01;

output of above query:
name1
name2
name1
name1
name2
name1
name3

I just want to see an output like:

name1
name2
name3

That there is an occurence, then select it, but if there was an
accurence donot select it again.

I hope I am not confusing you all , because I am not too good at
mySQL.
Thanks everyone.
ghasem


Jul 20 '05 #2
On 10 Aug 2004 05:10:21 -0700, in mailing.database.mysql
gh************@yahoo.com (ghasem) wrote:
| Greetings to all from the corner or Asia - guess where Iran!
| Going directly to the point, I need to know how can we match a
| pattern only once.
| "SELECT exp01 FROM tblExp01 " will give me all the occurences of
| exp01, my question is how can we see only non repeated occurences.
| Example:
| SELECT exp01 FROM tblExp01;
|
| output of above query:
| name1
| name2
| name1
| name1
| name2
| name1
| name3
|
| I just want to see an output like:
|
| name1
| name2
| name3
|
| That there is an occurence, then select it, but if there was an
| accurence donot select it again.
|
| I hope I am not confusing you all , because I am not too good at
| mySQL.
| Thanks everyone.


SELECT exp01 FROM tblExp01 GROUP BY exp01;

Jul 20 '05 #3
Thank you that was very helpful.
I tried it and gave exactly that answer I wanted. It is actually so
easy and basic but never came to me. Like I thought, I am not good at
SQL.
ghasem

Jeff North <jn****@yourpantsbigpond.net.au> wrote in message news:<40********************************@4ax.com>. ..
On 10 Aug 2004 05:10:21 -0700, in mailing.database.mysql
gh************@yahoo.com (ghasem) wrote:
| Greetings to all from the corner or Asia - guess where Iran!
| Going directly to the point, I need to know how can we match a
| pattern only once.
| "SELECT exp01 FROM tblExp01 " will give me all the occurences of
| exp01, my question is how can we see only non repeated occurences.
| Example:
| SELECT exp01 FROM tblExp01;
|
| output of above query:
| name1
| name2
| name1
| name1
| name2
| name1
| name3
|
| I just want to see an output like:
|
| name1
| name2
| name3
|
| That there is an occurence, then select it, but if there was an
| accurence donot select it again.
|
| I hope I am not confusing you all , because I am not too good at
| mySQL.
| Thanks everyone.


SELECT exp01 FROM tblExp01 GROUP BY exp01;

Jul 20 '05 #4
On 10 Aug 2004 20:58:14 -0700, in mailing.database.mysql
gh************@yahoo.com (ghasem) wrote:
| Thank you that was very helpful.
| I tried it and gave exactly that answer I wanted. It is actually so
| easy and basic but never came to me. Like I thought, I am not good at
| SQL.
| ghasem
|
| > SELECT exp01 FROM tblExp01 GROUP BY exp01;


As someone else pointed out you could also use the SELECT DISTINCT
option.

SELECT DISTINCT exp01 FROM tblExp01;
http://dev.mysql.com/doc/mysql/en/SELECT.html
---------------------------------------------------------------
All I can say to the fundamentalist christians is:
BRING BACK THE LIONS BRING BACK THE LIONS
BRING BACK THE LIONS BRING BACK THE LIONS
BRING BACK THE LIONS BRING BACK THE LIONS

jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 20 '05 #5
That is also a eal great way, I think this is a more elegant way of
selecting the groups. I do't know of the performance differences
between "select distinct" and "select ........group by......" , I have
few records right now with the possibility of having few thousand
records.
ghasem
Jeff North <jn****@yourpantsbigpond.net.au> wrote in message news:<fe********************************@4ax.com>. ..
On 10 Aug 2004 20:58:14 -0700, in mailing.database.mysql
gh************@yahoo.com (ghasem) wrote:
| Thank you that was very helpful.
| I tried it and gave exactly that answer I wanted. It is actually so
| easy and basic but never came to me. Like I thought, I am not good at
| SQL.
| ghasem
|
| > SELECT exp01 FROM tblExp01 GROUP BY exp01;


As someone else pointed out you could also use the SELECT DISTINCT
option.

SELECT DISTINCT exp01 FROM tblExp01;
http://dev.mysql.com/doc/mysql/en/SELECT.html
---------------------------------------------------------------
All I can say to the fundamentalist christians is:
BRING BACK THE LIONS BRING BACK THE LIONS
BRING BACK THE LIONS BRING BACK THE LIONS
BRING BACK THE LIONS BRING BACK THE LIONS

jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
14021
by: Andrew McLean | last post by:
I have a problem that is suspect isn't unusual and I'm looking to see if there is any code available to help. I've Googled without success. Basically, I have two databases containing lists of...
2
4673
by: CV | last post by:
How can I match 'n' number of neighbouring words of a pattern using regular expressions? For example, suppose I am looking for the pattern "length xyz cm" in some text. where xyz is a number -...
5
1384
by: ghasem | last post by:
Greetings to all from the corner or Asia - guess where Iran! Going directly to the point, I need to know how can we match a pattern only once. "SELECT exp01 FROM tblExp01 " will give me all the...
1
1074
by: Francesco Moi | last post by:
Hi. Is there any known routine to get the matching words within two arrays? Thank you very much.
1
1907
by: Iwan Petrow | last post by:
Hi, I want to count words in a string which are NOT with length 10. For me word is a sequence of symbols different from ' '. So I want to match these words. I think that the pattern has to be...
4
3035
by: Thomas Mlynarczyk | last post by:
Hello, I have two arrays like this: $aSearch = array( 'A', 'B', 'C.D', 'E', 'F' ); $aSubject = array( 'A' =0, 'A.B' =1, 'X' =2, 'C.D.E' =3, 'A.B.C' => 4 ); Now I want to search $aSubject...
1
1376
rajiv07
by: rajiv07 | last post by:
Hi to all I am trying to list all records which is very closely matching words.i googling for help but i could not get any correct info.Please any body help me on this problem. can i use the...
5
2113
by: gentsquash | last post by:
In a setting where I can specify only a JS regular expression, but not the JS code that will use it, I seek a regexp component that matches a string of letters, ignoring case. E.g, for "cat" I'd...
2
1637
by: lorlarz | last post by:
Looking for feedback on Matching Exercises Maker/ Builder: http://mynichecomputing.com/ReadIt/translateT.html For one thing, I am concerned about storing the matching kwork (known word) as...
0
7220
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
7105
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
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5617
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,...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
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
1534
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
410
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.