3 ms·
Well I have no idea how they store their data, but if it was straight T-SQL and assuming a table for tickets, a table for comments, and a table linking the two
by gotofritz 10y ago
Well I have no idea how they store their data, but if it was straight T-SQL and assuming a table for tickets, a table for comments, and a table linking the two (typical way to implemente 1-to-M relationships) something like (pseudo SQL)
SELECT * FROM tickets JOIN ticketsToComments on tickets.ID = ticketsToComments.ticket_ID join comments on ticketsToComments.comment_ID = comments.ID JOIN autor on comments.autor_ID = autor.ID where autor_ID = me and tickets.date < 1 week
It's not rocket science
- dragonwriter 10y ago> Well I have no idea how they store their data, but if it was straight T-SQL and assuming a table for tickets, a table for comments, and a table linking the two (typical way to implemente 1-to-M relationships) Wouldn't 1:M just be a typical FK relationship, a join table is only needed for either M:N relationships or relationships that have additional attributes belonging to the relationship rather than either of the joined tables.
- gotofritz 10y agoYes you are right, it was late at night :-) That makes it even simpler, removing one join... SELECT * FROM tickets JOIN comments on comments.ticket_ID = ticket.ID JOIN autor on comments.autor_ID = autor.ID where autor_ID = me and tickets.date < 1 week