Quale tabella contiene l'URL del post?

Sto usando l’esploratore dei dati per costruire una query che mostra i post di un utente: quale tabella posso usare per restituire l’URL del post? Ho pensato che sarebbe stato nella tabella posts, ma non lo vedo.

Questa è la mia query finora

SELECT u.email, c.name as post_category
 FROM posts p
left join user_emails u on p.user_id = u.user_id
left join topics t on p.topic_id=t.id
left join categories c on t.category_id = c.id
where p.created_at < '2021-03-01T00:00:00.000Z'
    GROUP BY
       u.email, u.user_id, c.name

Grazie.

1 Mi Piace

In SQL è

'/t/-' || topics.id || '/' || posts.post_number

Che nel tuo esempio sarebbe

SELECT u.email, c.name AS post_category, '/t/-' || t.id || '/' || p.post_number AS post_url
FROM posts p
LEFT JOIN user_emails u ON p.user_id = u.user_id
LEFT JOIN topics t ON p.topic_id = t.id
LEFT JOIN categories c ON t.category_id = c.id
WHERE p.created_at < '2021-03-01T00:00:00.000Z'
GROUP BY
    u.email, u.user_id, c.name
5 Mi Piace

Grazie, è ottimo.

Per tua informazione, con il trattino non funzionava, quindi invece di questo:

'/t-/' || topics.id || '/' || posts.post_number

ho usato

'/t/' || topics.id || '/' || posts.post_number

Tutto a posto :+1:

5 Mi Piace