I have so many domain names in my database, for example
www.yahoo.com/duniya.html
www.yahoo.com/hero.html
www.123musiq.com/
www.123musiq.com/home.html
www.123musiq.com/horo.html
www.123musiq.com/yuva.html
www.sensongs.com/
www.sensongs.com/hindi.html
www.sensongs.com/yuva.html
www.sensongs.com/duniya.html
www.sensongs.pk/duniya1.html
I need to sort them like, first 2 from yahoo, then next 2 from 123musiq, then next 2 from sensors. How can i do this? in mysql or php? I know, to get a domain name, I need to know how to sort 2 from each domain?
I use method match
Awaiting withdrawal
www.yahoo.com/duniya.html
www.yahoo.com/hero.html
www.123musiq.com/
www.123musiq.com/home.html
www.sensongs.com/
www.sensongs.com/hindi.html
I am using the following codeSELECT x.url
FROM (SELECT t.url,
CASE
WHEN @domain = SUBSTRING_INDEX (t.url, '/', 1) THEN @rownum: = @rownum + 1
ELSE @rownum: = 1
END AS rank,
@domain: = SUBSTRING_INDEX (t.url, '/', 1)
FROM URL2 t
JOIN (SELECT @rownum: = 0, @domain: = '') r
ORDER BY SUBSTRING_INDEX (t.url, '/', 1)) X
WHERE x.rank <= 2 AND MATCH (teet, url, html) AGAINST ('account');It shows an errorQuery: SELECT x.url FROM (SELECT t.url, CASE WHEN @domain = SUBSTRING_INDEX (t.url, '/', 1) THEN @row ...
Error Code: 1054
Unknown column 'teet' in 'where clause'
But Teet is a column in the URL2 table.