Morten Repsdorph Husfeldt Morten Repsdorph Husfeldt - 3 years ago 138
SQL Question

SQL join with 2 colummns with same name

I have created this query:

SELECT * FROM arrangement, booker WHERE arrangement.arrangement_id = booker.arrangement_id AND arrangement.dato BETWEEN '2017-09-29' AND '2017-14-10' AND booker.dato > '2017-22-09 18:31:53' AND arrangement.remind = '0'

Both arrangement and booker has a field called 'dato'. I try to use the 'dato' from booker as parameter.

I select 'arrrangement.dato between' that works fine

then I select 'booker.dato <'

However, the 'booker.dato <' fails and run in arrangement.dato when executing the query. Can anyone explain it to me?

Answer Source

use JOIN keyword with ON clause

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download