Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
user_id実行されるたびに ( の数に基づいて)異なる量の を返すクエリがありますsubscribers。
user_id
subscribers
私がする必要があるのは、これらのuser_id結果のそれぞれをテーブル内の別々の行に挿入し、別の列に「新しいアラート」という単純なメッセージを挿入することです。
どうすればこれを行うことができますか?この状況で for each ループは機能しますか?
これを試して:
INSERT INTO alert_table SELECT user_id, 'new alert' FROM ... WHERE ...
INSERT INTO alert_table句を先頭に追加するだけで、独自のクエリを使用できます。
INSERT INTO alert_table