473,473 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Create 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 1382

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
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
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
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
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
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...
7
by: Timo Haberkern | last post by:
Hi there, i have some troubles with my TSearch2 Installation. I have done this installation as described in http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_compound_words...
4
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
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
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
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
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
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
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
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...
0
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
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
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
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.