联接两个没有关系的SQL表?

编程入门 行业动态 更新时间:2024-10-24 18:28:24
本文介绍了联接两个没有关系的SQL表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在MySQL数据库中有2个表.一个是具有字段('landlord_id')的旧表(地主).

I have 2 tables in a MySQL database. One is a legacy table (landlords) which has a field ('landlord_id').

另一个是Joomla! 1.7称为jos_users的表,用于确保所有用户都是有效的Joomla!用户并可以登录等.它有一个名为"id"的字段.

The other is a Joomla! 1.7 table called jos_users which is needed to ensure all users are valid Joomla! users and can login, etc. It has a field called 'id'.

例如,我在landlords.landlord_id = 2(约翰·史密斯)中已有一条记录,但是没有相应的jos_user.id记录,因为在jos_users之前已经存在地主表.

As an example I have an existing record in landlords.landlord_id = 2 (John Smith), however there is no corresponding jos_user.id record because the landlords table pre existed before the jos_users.

是否可以使用SQL在两者之间建立/创建关系?

Is there a way to establish / create a relationship between the two using SQL?

我是否需要为房东创建jos_user记录(如果需要,如何创建?)?

Do I need to create jos_user records for the landlords (and if so how?)?

任何建议或示例都将不胜感激.

Any suggestions or examples are greatly appreciated.

推荐答案

您将不得不将数据从旧系统移植到新系统.我假设您使用的是Joomla的用户登录系统,对吗?如果您理解的话,在这种情况下,数据必须采用joomla在其中查找的格式和位置.

You will have to port across the data from the old system to the new system. I assume that you're using Joomla's user login system right? In which case the data will have to be in the format and place joomla is looking for it in, if you understand.

不复制数据就无法真正创建链接".

You can't really create a "link" without replicating data.

我建议您可以做的是在房东的表中添加一个字段,即joomla_user_id.这样,您可以将joomla用户与旧系统中的房东记录相关联.这样一来,您无需手动移植任何内容,就可以构建应用程序,以根据其joomla用户ID获取房东数据.

What you CAN do, which I suggest, is to add a field onto the landlord's table which is joomla_user_id. This way you can associate a joomla user with a landlord record from your old system. That way you don't have to manually port anything across, and you can build the app to get the landlord data based on their joomla user id.

更多推荐

联接两个没有关系的SQL表?

本文发布于:2023-10-28 18:26:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537419.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两个   关系   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!