Using String function in LEFT JOIN

Copper Contributor

Hello, I have 2 table. I want classified URL who is in table [Activite_Site] I've try the query below, but it doesn't work... Anyone have idea.
Thank you in advance

 

Table [Categorie]
URL                                          CAT
http//www.site.com/business B2B
http//www.site.com/office      B2B
http//www.site.com/job          B2B
http//www.site.com/home      B2C

 

Table [Actvite_Site]
URL
http//www.site.com/business/page2/test.html
http//www.site.com/business/page3/pagetest/tot.html
http//www.site.com/office/all/tot.html
http//www.site.com/home/holiday/paris.html
http//www.site.com/home/private/moncompte.html

 

I would like OUTPUT :

URL_SITE                                                                           CATEGORIE
http//www.site.com/business/page2/test.html                B2B
http//www.site.com/business/page3/pagetest/tot.html  B2B
http//www.site.com/office/all/tot.html                             B2B
http//www.site.com/home/holiday/paris.html                 B2C
http//www.site.com/home/private/moncompte.html      B2C
http//www.site.com/test/pte.html                                    Null

 

My query :

SELECT A.URL AS URL_SITE,
            C.CAT AS CATEGORIE
FROM Actvite_Site as A
          LEFT OUTER JOIN Categorie as C ON C.URL==A.URL.PadLeft(C.URL.Lenght)

0 Replies