What's the mistake in the following query?

时间:2018-07-24 10:25:09

标签: python-3.x ms-access

I have the following query:

strsql = """SELECT referencia, concepto, sfamilia, pvp, puc FROM almacen2 WHERE concepto like '*YATEKOMO*'"""

I use this sentence in python with the Access Driver.

When I execute this in my code:

strsql = """SELECT referencia, concepto, sfamilia, pvp, puc FROM almacen2"""

I get a lot of results.

And when I try to execute the query with the tag LIKE in Access directly, I get 8 results.

What's my mistake so I get results out of my code and not in it?

1 个答案:

答案 0 :(得分:0)

使用%代替*

或者使用concepto ~ 'YATEKOMO'

做RegEx

糟糕,我可以看到这与访问有关。我的答案更适合PostgreSQL。