i have a table in mysql
Table name: related_tags
tag_1 | tag_2
....................
iphone ipod
ipad ipone
iphone mac
iphone apple
ipod ipone
iphone ipod
apple iphone
i want to print related tags to the iphone from this table..
and the tags which is used more times with iphone should be at 1st
eg: ipod (used 3 times), apple used 2 times
ipod should be 1st and apple must be 2nd and so on.
what will be the exect query
The fact that you're numbering your columns shows that something is wrong with your schema in the first place. You should have one table containing all tags (tagID, tagName) and then a second table where you store the relations (tagID, tagID). This way you can easily query your relations.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.