D
D
demortall2021-10-31 11:21:56
SQL
demortall, 2021-10-31 11:21:56

How to use two WHERE clauses in one SQL?

I need to take design by two sql query criteria.
cur.execute("SELECT design FROM links WHERE domain='" + o.hostname + "', link='" + path + "'")
I thought to do it this way, but I don't know if it works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2021-10-31
@demortall

SELECT design FROM links WHERE domain='" + o.hostname + "' and link='" + path + "'
Just keep in mind that gluing SQL query from strings, as you do, is 100% bad practice, which is fraught with SQL injection . Use Prepared Statements

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question