开发者

Can this be done in one query?

table

id (primary)
key1,key2,key3 (secondary)

given id N

query #1

select key1,key2,key3 from开发者_C百科 table where id=N  --  key1n,key2n,key3n

query #2

select * from table where key1 = key1n and key2 = key2n  --  results...


SELECT  t2.*
FROM    table t1
JOIN    table t2
ON      t2.key1 = t1.key1
        AND t2.key2 = t1.key2
        AND t2.key3 = t1.key3
WHERE   t1.id = '$N'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜