有两个表 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;
}请问怎么写?
解决方案 »
- 如何用PHP只发送POST而不返回值
- 目前php做导入excel表格中的数据到Mysql,用到file_exists检查到文件不存在,而文件是存在的,大家帮忙
- 读EXCEL时出现Detected an illegal character in input string in
- 怎么做,才能搜索出两个MYSQL数据库的内容
- 安装GD模块遇到的问题
- swfupload真的就没人成功用到项目上吗?????
- 111
- 自定义function问题 ~~~
- 登录验证码,关于smarty模板的问题
- PHP水印图片按比例缩放后,并写入到原图到某个xy怎么写
- 怎样点击修改按钮后,能修改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两项都不等,但是怎么能得出结果?