Oracle SQL : timestamps in where clause

to_timestamp() You need to use to_timestamp() to convert your string to a proper timestamp value: to_timestamp(’12-01-2012 21:24:00′, ‘dd-mm-yyyy hh24:mi:ss’) to_date() If your column is of type DATE (which also supports seconds), you need to use to_date() to_date(’12-01-2012 21:24:00′, ‘dd-mm-yyyy hh24:mi:ss’) Example To get this into a where condition use the following: select * from TableA … Read more

MySQL Select last 7 days

The WHERE clause is misplaced, it has to follow the table references and JOIN operations. Something like this: FROM tartikel p1 JOIN tartikelpict p2 ON p1.kArtikel = p2.kArtikel AND p2.nNr = 1 WHERE p1.dErstellt >= DATE(NOW() – INTERVAL 7 DAY) ORDER BY p1.kArtikel DESC EDIT (three plus years later)    The above essentially answers the question … Read more

Is a JOIN faster than a WHERE?

Theoretically, no, it shouldn’t be any faster. The query optimizer should be able to generate an identical execution plan. However, some database engines can produce better execution plans for one of them (not likely to happen for such a simple query but for complex enough ones). You should test both and see (on your database … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)