Reminder.

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Reminder.

Post by mqley » 2021-04-21 17:01

Hi, I've tried this but it gives me SQL errors. Adding incomeTracker in two places below. What am I doing wrong:

SELECT e.id,e.title,reminder_date,e.reminder_flag,u.memberID,u.email FROM expenseTracker, incomeTracker e
LEFT JOIN membership_userrecords m ON e.id=pkValue and m.tableName='expenseTracker', 'incomeTracker'
LEFT JOIN membership_users u on m.memberID=u.memberID
WHERE e.reminder_flag>='1' ORDER by e.id";
Best Wishes,

Mark

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1817
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Reminder.

Post by jsetzer » 2021-04-21 17:26

It would help us helping you if you could give more details on the tables and relations, perhaps an excerpt from your ERM.

I don't know your tables but for me the first JOIN looks weird.

The FROM clause naming two tables without joining them should result in a cartesian product which may not be what you want.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Reminder.

Post by mqley » 2021-04-22 17:17

Hi, the original code was from pböttcher and it worked without any tweaks. The full code uses a custom page, that looks through all members and if they have a matching date 'Reminder' set in the application then it emails the user giving some info about the reminder.

I just wanted the same but to include another table - so it looks at the 2 tables rather than one. I have it working by duplicating the code:

So the original code from pböttcher run an sql from the table 'expenseTracker'
SELECT e.id,e.title,reminder_date,e.reminder_flag,u.memberID,u.email FROM expenseTracker e
LEFT JOIN membership_userrecords m ON e.id=pkValue and m.tableName='expenseTracker',
LEFT JOIN membership_users u on m.memberID=u.memberID
WHERE e.reminder_flag>='1' ORDER by e.id";

Then duplicated to run another sql from another table 'incomeTracker'
SELECT e.id,e.title,reminder_date,e.reminder_flag,u.memberID,u.email FROM incomeTracker e
LEFT JOIN membership_userrecords m ON e.id=pkValue and m.tableName='incomeTracker'
LEFT JOIN membership_users u on m.memberID=u.memberID
WHERE e.reminder_flag>='1' ORDER by e.id";

I won't need more than 2 tables so probably not too bad this duplication, but if there is a way to concatenate it would be better.

Thanks.
Best Wishes,

Mark

Post Reply