有两个表 dutbin 和 testitemdutbin结构:
DID (主键 自增长)
customerlotid
state
hifix
pgm
pgm version
bin
testitem
testitem结构:
did
pgm
pgm_version
testitem_no
testitem_nifo现在求testitem_info,判别条件:当dutbin的pgm,pgm version和表testitem的pgm,pgm version一一对应相等时,testitem_no的值等于x时,求得testitem_info.用程序理解吧:
if((testitem.pgm==dutbin.pgm)&&(testitem.pgm_version==dutbin."Pgm version"))
{
sql = select testitem_info from testitem where testitem_no = 'x';
result;
}请问怎么写?
DID (主键 自增长)
customerlotid
state
hifix
pgm
pgm version
bin
testitem
testitem结构:
did
pgm
pgm_version
testitem_no
testitem_nifo现在求testitem_info,判别条件:当dutbin的pgm,pgm version和表testitem的pgm,pgm version一一对应相等时,testitem_no的值等于x时,求得testitem_info.用程序理解吧:
if((testitem.pgm==dutbin.pgm)&&(testitem.pgm_version==dutbin."Pgm version"))
{
sql = select testitem_info from testitem where testitem_no = 'x';
result;
}请问怎么写?
解决方案 »
- 关于使用ssh2_exec修改user密码的问题
- preg_replace 可以替换指定的TABLE吗 ?
- php 导入.sql文件
- linux下2个权限相同的文件夹 一个friends_list可以遍历文件夹读和写 guest_book就不能
- PHP + ORACLE10G ,分页问题
- 列表框的change事件,如可用PHP处理
- 我的 My SQL 的 UPDATE 更新功能错误
- 查询条件如何带到第二页?
- 急。。。求这样形式的分页
- 那位高手知道NT+APACHE+PHP+MODSSL+OPENSSL怎么配置呢?
- 怎样点击修改按钮后,能修改wage输入框里的数据并保存到数据库,以后查询数据库时,数据时修改后的数据呢?
- 请教我看的参考书上的问题
select testitem_info from dutbin d,testitem t where d.pgm = t.pgm and d.pgm_version = t.pgm_version and testitem_no = 'x';
这样不行么?
left join testitem te on(te.pgm=du.pgm and te.pgm_version=du.pgm_version)where te.testitem_no='x'
我的意思是能不能先单独判断d.pgm = t.gm && d."Pgm version"=t.gm_version,再进行后续操作?像这样,
if((testitem.pgm==dutbin.pgm)&&(testitem.pgm_version==dutbin."Pgm version"))
{
sql = select testitem_info from testitem where testitem_no = 'x';
result;
}
答案不正确啊。a.pgm!=b.pgm时也有正确结果。
select te.testitem_nifo from dutbin du,testitem te
where te.pgm=du.pgm and te.pgm_version=du.pgm_version and te.testitem_no='x'
select dutbin.PGM,dutbin."Pgm version",testitem.TESTITEM_INFO from dutbin left join testitem on(testitem.PGM = dutbin.PGM and testitem.PGM_VERSION = dutbin."Pgm version")where testitem.TESTITEM_NO = 46;结果:
O624XF3D N.30 abcabc
O624XF3D N.30 abcabc
O624XF3D N.30 abcabc
O624XF3D N.30 abcabc但是select dutbin.pgm,dutbin."Pgm version" from dutbin
的结果却是:
T534W8U6 N.21这pgm,pgm version两项都不等,但是怎么能得出结果?