Answer the question
In order to leave comments, you need to log in
Links between databases not implemented by postgresql?
There is a table artist and user_artist
artist:
- id (PK)
- name
user_artist:
- id (PK)
- userId(FK)
- artistId(FK)
- added
ссылки между базами не реализованы: user_artist.added
return db.query(`
SELECT artist.name AS "artistName", artist.id AS "artistId", user_artist.added
FROM user_artist
INNER JOIN artist
ON artist.id = user_artist."artistId"
WHERE user_artist."userId" = $(userId)
AND user_artist.added::timestamp < to_timestamp($(index) / 1000)
ORDER BY user_artist.added $(order)
LIMIT $(limit);`, obj);
ORDER BY user_artist.added $(order)
, the error disappears. create table user_artist
(
"id" serial primary key,
"userId" serial REFERENCES user (id) on delete cascade,
"artistId" serial REFERENCES artist (id) on delete cascade,
"added" timestamp,
unique ("userId", "artistId")
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question