如何从同一个数据库和同一个表中检索两个不同的数据。

编程入门 行业动态 更新时间:2024-10-23 19:29:39
本文介绍了如何从同一个数据库和同一个表中检索两个不同的数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

数据库名称:bd1 表名:schedule 字段:associate_name,Category,Aux,Time Raj ABC登录,9: 00:00 Raj ABC退出6:00:00 i想要以下输出 associate_name,Category,Aux,Login时间,退出时间 Raj ABC登录9:00:00 6:00:00 请帮助我..我是新来的。 Raj。

Database name : bd1 Table Name : schedule Fields : associate_name, Category, Aux, Time Raj ABC Login, 9:00:00 Raj ABC Logout 6:00:00 i want the below output associate_name, Category, Aux, Login Time, Logout Time Raj ABC Login 9:00:00 6:00:00 Please help me out.. im new to this. Raj.

推荐答案

将表连接到自身。您还需要一个排名列,以便您可以加入到下一行。 Join the table to itself. You will need a ranking column also so that you can join to the next row.

在表中首先将一列作为主键,然后在另一个表中将其用作外键然后它将很容易检索数据 first in a table make one column as a primary key and den use it in another table as a foreign key then it will b easy to retrieve data

@syed,这不会工作。我们这里只讨论一个表,而不是两个。 @syed, that won''t work. We are only talking about one table here, not two.

更多推荐

如何从同一个数据库和同一个表中检索两个不同的数据。

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

发布评论

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

>www.elefans.com

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