English 中文(简体)
核对数据库中的两栏
原标题:Matching two columns from a database

I m gonna为客户实施新的设计/网站结构,但我没有什么问题。 由于创建的URLs I ve是一个微不足道的不同之处,因此,由于四分五裂的URLs的浮板,Im 预示着在低地轨道上出现问题。 我的想法是,将现有的URLs(旧址)与我创建的新楼相匹配。

我 st倒的问题是:

The old URLs are like http://www.example.com/category/numeric_id-item-name_item_code.html and the new URLs are likehttp://www.example.com/item_name-item_code.

In MySQL 我创建了一个新数据库,该数据库在旧网站的首个栏目——名称和项目——代码上,并从新数据库中建立了第二栏。

The idea is as it follows: Example: Let s say we have an item named spring leaf with the code sl34. The old URL would be something like http://www.example.com/springs/53-spring-leaf-sl34.html. For matching this URL there are 3 possibilities:

  1. If the product is in the new website http://www.example.com/spring-leaf-sl34
  2. In case they modified the name http://www.example.com/iron-spring-leaf-sl34
  3. In case the product is not in the new website: http://www.example.com/springs

我需要帮助建立这些匹配。

谢谢。

最佳回答

因此,显然,我发现某种快速解决方案:

CREATE
   VIEW `database`.`url_view` 
    AS
(SELECT old_table.old_url, new_table.new_url FROM old_table LEFT JOIN new_table ON old_table.product_code=new_table.product_code);

这将把旧的URL与新版本联系起来,如果旧的URL(产品)已不复存在,它将插入一个(NUL)条目。

问题回答

暂无回答




相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...

热门标签