[Tutor] Help with a SQL Statement
Alan Gauld
alan.gauld at btinternet.com
Sun Nov 18 16:53:32 CET 2012
On 18/11/12 11:29, Khalid Al-Ghamdi wrote:
> The SQL statement below doesn't return anything.. and I don't know
> why... I've used the parans but still no luck. Any Suggestions?
I'll restructure it to how I think you want it...
cur.execute("""
select badge, name, stage, tc, major, package, subject, course, sb_as
from records
where
sb_as = 0 and
(subject like 'Workshop&') or
(subject like 'Basic%') or
(subject like 'Introduction%') and
(major not like 'Customer%') or
(major not like 'Warehouse%')
order by tc""")
See if that helps... I think your parens were grouping the wrong things.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list