佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 967|回复: 3

请教一段sql statement....

[复制链接]
发表于 17-7-2006 12:39 PM | 显示全部楼层 |阅读模式
property_table
PID    code      update_date
P101   ABC999    2006-07-14
P102   ABC998    2006-07-14

note_table
NID    code       username   insert_date
N101   ABC999     Jack       2006-07-04

user_table
UID    username     name
U101   Jack         Lee
U102   Cindy        Loh

SELECT p.code, p.update_date, n.insert_date FROM
property_table p INNER JOIN note_table n ON n.code = p.code
WHERE p.insert_date > n.update_date


我要如何将上面的sql statement合并下面的sql statement?

SELECT user_table.name FROM user_table INNER JOIN note_table
ON user_table.username = note_table.username
回复

使用道具 举报


ADVERTISEMENT

发表于 17-7-2006 01:41 PM | 显示全部楼层
你要怎样的RESULT?还有你的问题很模糊-。-!!
回复

使用道具 举报

发表于 17-7-2006 08:49 PM | 显示全部楼层
pid_table
PID    code      update_date
P101   ABC999    2006-07-14
P102   ABC998    2006-07-14

note_table
NID    code       username   insert_date
N101   ABC999     Jack       2006-07-04

user_table
UID    username     name
U101   Jack         Lee
U102   Cindy        Loh

SELECT * FROM pid_table,note_table,user_table
WHERE pid_table.code = note_table.code and
note_table.username = user_table.username
你要的是不是这样 ?
回复

使用道具 举报

发表于 17-7-2006 09:05 PM | 显示全部楼层
SELECT t.name,p.code, p.update_date, n.insert_date
FROM property_table p
INNER JOIN note_table n ON n.code = p.code
INNER JOIN user_table t ON t.username=n.username
WHERE p.insert_date > n.update_date

username 在 note_table 的 structure 该 换 成  UID 较 好 ..

SELECT t.name,p.code, p.update_date, n.insert_date
FROM property_table p
INNER JOIN note_table n ON n.code = p.code
INNER JOIN user_table t ON t.UID=n.UID
WHERE p.insert_date > n.update_date

soonyu
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-9-2024 05:34 AM , Processed in 0.103877 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表