I am new to SQL and it is not able to understand why this query does not return, but I know That's because I am using OR the situation incorrectly if
Can someone show it correctly to know about it?
SELECT trddata.id, trddata.ts, instr.name, instr.underlying, instr.expiration, instr.strike, instr.callput, opnint.vol, trdind.name Ind, exch. name Exch, trddata.price, trddata.bidprcbbo, the trdopt on trddata.askprcbbo trddata instropt instr include trddata.optid = instr.id Join trdindopt Join trdind.id = on trdind trddata.ind which trddata.exchcode on exchopt Exch = exch.id opnintopt Join Where opnint.optid = trddata.optid on opnint opnint.ds = DATE_FORMAT (trddata.ts, '% Y-% m-% d') and trddata.id & gt; = 71125752 and trddata.ts & lt; = '2013-06-20 16:30:36' and = instr.underlying 'AAPL' and exch.name = "AMEX" or exch.name = 'en: CBOE or exch.name = "ISE" or exch.name = 'PHLX' command trddata.id LIMIT 100;
It looks like you want some brackets:
and (exch.name = 'AMEX' or exch.name = 'CBOE' or exch.name = 'ISE' or exch.name = 'PHLX') you can also can use IN:
and exch.name IN ( 'AMEX', 'CBOE', 'ISE', 'PHLX')
No comments:
Post a Comment