0
私はユーザーギャラリーをアップロードするテーブルを持っています。 gallery.created_atのユーザーが2か月以上アップロードされている必要があります。 私はこれを試してみましたが、それは私に0結果Mysql- 2か月以上アップロードされたデータを選択します。
select `galleries`.`client_id` as `client_id`,
`users`.`first_name` as `first_name` from `galleries`
inner join `users` on `users`.`id` = `galleries`.`client_id`
where `galleries`.`session_id` is null and
`galleries`.`is_video` = '1' and `galleries`.`is_thumb` = '1' and
galleries.created_at >= galleries.created_at - INTERVAL 2 MONTH
`galleries`.`client_id` not in (select `client_id` from
`orders`)
これは、galleries.created_atとcrrent_dateの間のデータを返します.2ヶ月、つまり2月15日〜2017日です。 galleries.created_atが2か月以上経過しているデータが必要です – baig772
@ baig772 - あなたが質問で言ったように '<='が必要です - '2ヶ月以上アップロードしました ' – GurV
もそれを試しました。 – baig772