MySQL Forums
Forum List  »  Newbie

Re: How to SELECT DISTINCT and SPLIT ?
Posted by: Peter Brawley
Date: March 02, 2016 12:15PM

Table design problems ...

1. Does "1,2" mean 1.2 or the two integer values 1,2? If the former, the tables violate a basic requirement; tear them down and redesign them for one value per cell.

2. Column names of the form xxx1, xxx2 etc usually indicate that the table is incorrectly designed. Your need to combine mdata1 and mdata2 in one query result agrees, indicating that their contents should be in one column and their digit suffixes in another, eg ...

mdata int,
param smallint

Then you can write your query as ...

select group_concat(mdata)
from tbl
where param in(1,2);

select group_concat(distinct mdata)
from tbl
where param in(1,2);

Options: ReplyQuote


Subject
Written By
Posted
Re: How to SELECT DISTINCT and SPLIT ?
March 02, 2016 12:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.