If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MySql query please help me

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-04, 23:33
s_ben123 s_ben123 is offline
Registered User
 
Join Date: Mar 2004
Posts: 4
Lightbulb MySql query please help me

Hi
I am a newbie to MySql, I learnt that it does not support sub selects, I have a problem

I have primary keys like this

JA.01.01
JA.01.02
JA.01.03
JA.02.01
JA.02.02

what i want is i want to get (unique ones)

JA.01.XX
JA.02.XX
JA.03.XX

as results.
Reply With Quote
  #2 (permalink)  
Old 03-02-04, 00:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
select distinct concat_ws('.',left(pkey,5),'XX') from yourtable
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-02-04, 00:51
s_ben123 s_ben123 is offline
Registered User
 
Join Date: Mar 2004
Posts: 4
Thanks

Quote:
Originally posted by r937
select distinct concat_ws('.',left(pkey,5),'XX') from yourtable

Hi it worked thanks for your help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On