MySQL查询传递不需要的数据

时间:2019-04-23 23:01:14

标签: mysql

我正在尝试使用以下查询搜索数据库:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-11-44e890d9998b> in <module>()
      4 import seaborn as sns
      5 import os
----> 6 import cv2
      7 import random
      8 from keras.models import Sequential

ImportError: dlopen(/anaconda3/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: @rpath/libjasper.1.dylib
  Referenced from: /anaconda3/lib/libopencv_highgui.2.4.13.dylib
  Reason: image not found

但是无论其中一个字段中是否有// With hooks for rn import React, { useState, useEffect } from 'react' import { Text, View, TouchableOpacity, Image, StyleSheet } from 'react-native' import styles from '../../assets/styles' const usePanelExpanding = (props) => { let icons = { 'up': require('../../images/formicons/icons/close.png'), 'down': require('../../images/formicons/icons/disclosure.png') } const [expanded, setExpanded] = useState(false); const [iconShow, setIconShow] = useState('up'); const [textSwap, setTextSwap] = useState('Show more...'); useEffect( () => { expanded ? setIconShow('up') : setIconShow('down') expanded ? setTextSwap('Show less') : setTextSwap('Show more ...') }, [expanded] ); const toggle = () =>{ setExpanded(!expanded) } const panel = (<View> <View style={styles.titleContainer} > <TouchableOpacity style={styles.button} onPress={toggle} > <Image style={styles.buttonImage} source={icons[iconShow]} /> </TouchableOpacity> </View> {expanded && <View style={styles.mainPageFull} > {props} </View> } </View>) return { panel, toggle } } export default usePanelExpanding // How to use it from a parent function const expandingBioObject = usePanelExpanding(<Text>{profile.bio}</Text>) <Card title="Biography" containerStyle={styles.CardContainerBio}> {expandingBioObject.panel} </Card> ,我都会收到SELECT jobunique, jobtypeunique, joblat, joblng FROM job WHERE jobdeleted = 0 AND jobpayed = 1 AND (LOWER(jobtitle) LIKE '%taxi%' OR LOWER(jobmaincategory) LIKE '%taxi%' OR LOWER(jobsubcategory) LIKE '%taxi%' OR LOWER(jobdescription) LIKE '%taxi%' OR LOWER(jobcountry) LIKE '%taxi%') AND ( jobbusiness = 1 AND jobstartdate <= CURDATE() AND jobenddate >= CURDATE() ) OR ( jobbusiness = 0 AND jobfixedstartdate = 0 AND jobfixedenddate = 0 AND jobdateadded >= (CURDATE()-INTERVAL 60 DAY) ) OR ( jobbusiness = 0 AND jobfixedstartdate = 1 AND jobfixedenddate = 0 AND jobstartdate >= CURDATE() ) OR ( jobbusiness = 0 AND jobfixedstartdate = 1 AND jobfixedenddate = 1 AND jobenddate <= CURDATE() ) 处的所有行。有人可以向我解释原因吗?谢谢

1 个答案:

答案 0 :(得分:4)

您需要在最后一组OR个条件周围加上一组括号,否则最后三个条件仅会OR个与其他条件无关。请注意,您不需要在()条条件下使用AND,因为无论如何AND都比OR优先。将您的WHERE条件的最后一部分更改为此可以解决问题:

AND (
        jobbusiness = 1 AND jobstartdate <= CURDATE() AND jobenddate >= CURDATE()
    OR
        jobbusiness = 0 AND jobfixedstartdate = 0 AND jobfixedenddate = 0 AND jobdateadded >= (CURDATE()-INTERVAL 60 DAY) 
    OR
        jobbusiness = 0 AND jobfixedstartdate = 1 AND jobfixedenddate = 0 AND jobstartdate >= CURDATE()
    OR
        jobbusiness = 0 AND jobfixedstartdate = 1 AND jobfixedenddate = 1 AND jobenddate <= CURDATE()
)