如何从同一个数据库和同一个表中检索两个不同的数据。 [英] How to retrieve two different data from same database and same table.

查看:93
本文介绍了如何从同一个数据库和同一个表中检索两个不同的数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库名称: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.


这篇关于如何从同一个数据库和同一个表中检索两个不同的数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆