select r.EQUCODE, r.POSITIONSTATUS, r.AddressType, r.RENTINGSTATUS, r.notes, r.effectivedate, r.createtime, r.AB_TEST_TYPE from SCM_HX01_EquStatusRecord r left join SCM_HX00_EQUCARDHEAD h on r.EQUID = h.billid where h.equno in ('THX-PH00006MOBA-10457H', 'THX-PH00010MOBA-10457H', 'THX-PH00011MOBA-10457H', 'THX-PH00055MOBA-10457H', 'SHX-JG00616GS2646', 'SHX-WG00012AMWP 11.5-8100', 'SHX-JG21500JCPT1212HD', 'SHX-JG21501JCPT1212HD', 'SHX-JG21502JCPT1412HD', 'SHX-JG21503JCPT1008HD', 'SHX-JG21504JCPT1008HD', 'SHX-WG00014AMWP 11.5-8100', '苏ET6X38', 'SHX-S023', 'SHX-S062', 'SHX-SG00105S60X', 'SHX-SG00120660SJ', 'SHX-SG00128660SJ', 'SHX-SG00129660SJ', 'SHX-SG00175660SJ', 'SHX-SG00182660SJ', 'SHX-SG00189660SJ', 'SHX-SG00208860SJ', 'SHX-SG00224660SJ', 'SHX-SG00245S65', 'SHX-SG00324860SJ', 'SHX-SG00457660SJ', 'GHX-DJ00049PCF-450', 'GHX-DJ00046PCF-350', 'GHX-DJ00048PCF-450') AND NOTES LIKE '%处置出库%' order by r.effectivedate desc, r.billid desc;
时间: 2023-12-23 12:04:50 浏览: 122
这是一个 SQL 查询语句,用于查询 SCM_HX01_EquStatusRecord 表中符合条件的记录。具体的查询条件包括:
- 查询的字段包括:EQUCODE、POSITIONSTATUS、AddressType、RENTINGSTATUS、notes、effectivedate、createtime、AB_TEST_TYPE。
- 查询的表是 SCM_HX01_EquStatusRecord,同时与 SCM_HX00_EQUCARDHEAD 表进行了左连接(left join)。
- 查询的条件是:SCM_HX00_EQUCARDHEAD 表中的 equno 字段匹配给定的一组值,同时 SCM_HX01_EquStatusRecord 表中的 notes 字段包含字符串 "处置出库"。
- 查询结果按照 effectivedate 和 billid 字段进行降序排序。
值得注意的是,由于我无法访问你的数据库,因此无法判断这个查询语句是否正确或者是否适合你的具体需求。请在使用之前自行验证并进行必要的修改。
相关问题
SELECT '155427848241370' || SEQ_KD_INDEX.nextval || 'GJ', a.PROBABLECAUSE, ( SELECT zhFUNc_GETNEWIDFORCIR ( id ) FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), '1028200001', ( SELECT name FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), ( SELECT code FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), a.IP, a.ALARMTIME, a.alarmtext, SYSDATE, NULL, a.alarmid, a.createtime, a.perceivedseverity, a.moname FROM ( SELECT x.*, ( SELECT COUNT( DISTINCT re.coveraddressid ) FROM gistar.jr_customer_record @yjyx_zy re WHERE re.project_type IN ( 'FTTH宽带' ) AND re.oltip = x.IP ) AS oltcount FROM gistar.t_trouble_alarminfo x ) a WHERE a.specialty = 'PON' AND a.motype = 'OLT' AND IP IS NOT NULL AND a.PROBABLECAUSE = 'OLT网管脱网' AND ( SELECT substr( b.tt_number, 0, 2 ) FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'NM' AND ( SELECT title FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'OLT网管脱网' AND ( ( SYSDATE < '2021-05-01' AND a.oltcount >= 600 ) OR a.oltcount >= 400 ) UNION ALL SELECT '155427848241370' || SEQ_KD_INDEX.nextval || 'GJ', a.PROBABLECAUSE, ( SELECT zhFUNc_GETNEWIDFORCIR ( id ) FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), '1028200001', ( SELECT name FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), ( SELECT code FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), a.IP, a.ALARMTIME, a.alarmtext, SYSDATE, a.cleartime, a.alarmid, a.createtime, a.perceivedseverity, a.moname FROM ( SELECT x.*, ( SELECT COUNT( DISTINCT re.coveraddressid ) FROM gistar.jr_customer_record @yjyx_zy re WHERE re.project_type IN ( 'FTTH宽带' ) AND re.oltip = x.IP ) AS oltcount FROM gistar.t_trouble_alarminfo x ) a WHERE a.specialty = 'PON' AND a.motype = 'OLT' AND IP IS NOT NULL AND a.PROBABLECAUSE = 'OLT网管脱网' AND ( SELECT substr( b.tt_number, 0, 2 ) FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'NM' AND ( SELECT title FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'OLT网管脱网' AND ( ( SYSDATE < '2021-05-01' AND a.oltcount >= 600 ) OR a.oltcount >= 400 ) AND a.cleartime IS NOT NULL AND a.alarmid IN ( SELECT alarm_id FROM olt_ALARM_BILL GROUP BY alarm_id, device_ip, alarm_time, create_time HAVING count( * ) = 1 );报错ORA-02287: sequence number not allowed here
这个 SQL 语句中使用了 SEQ_KD_INDEX.nextval,而在 SELECT 语句中不能直接使用序列的 nextval() 方法,因为 nextval() 方法不是一个常量或字面值,而是一个函数,因此不能在字符串中直接使用。要解决这个问题,可以将 nextval() 放在一个子查询中,然后在 SELECT 语句中引用该子查询的结果。例如,可以将第一个 SELECT 语句修改如下:
```
SELECT '155427848241370' || (SELECT SEQ_KD_INDEX.nextval FROM dual) || 'GJ', a.PROBABLECAUSE, ...
```
这样就可以在字符串中引用 nextval() 方法的返回值了。注意,这里使用了 Oracle 中的 dual 表来执行子查询,因为在 Oracle 中,必须使用 FROM 子句来指定一个表,即使这个表只包含一行数据也是如此。
怎么解决his.form.createTime = new Date().toISOString().slice(0, 10)比实际日期少一天
您好!您的问题看起来是一个时间格式的问题。请注意,toISOString()方法返回的时间是UTC时间,而不是当前本地时间。因此,可能需要将获取的时间转换为本地时间。可以使用以下代码来将UTC时间转换为本地时间:
```
var currentTime = new Date();
var offset = currentTime.getTimezoneOffset();
currentTime = new Date(currentTime.getTime() - (offset*60*1000));
```
这里,我们首先获取当前时间(UTC时间),然后获取当前时区偏移量,并用它来将时间转换为本地时间。然后,您可以用这个时间来设置您的form.createTime。希望这可以帮助您解决问题。
阅读全文