Skip to content

Tag: sql

How to expand categories by id in SQL

I have the following table: I would like to have for each org_id, person_id, month a line for each category of consultation_mode and professional_domain, as per the below: There are 3 consultation_mode: in person, telephone, home visit & 3 professional_domain: doctor, nurse, other. How can I do this in SQ…

req.query returns nothing

Trying to get variable from http://localhost:3000/categories/subcategories?category_id=13 but req.query returns empty result. Is this possibly a problem with the way I’ve set up my server? Answer See how you are passing the data , directly entering the data or from another URL you are passing the data. …

MySQL query fails on syntax [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 4 m…

How do I change a text to an enum type?

so basically I want to import a csv file and one of the columns has the data yes/no in it and I have created an enum that has values ‘red’ and ‘white’ and the yes related to ‘red’ in the enum and no relates to ‘white’ in the enum and the column in the table in t…

How to fix Encoding error utf-8 – PostgreSQL

I am following instructions online to create a database in pgAdmin4. I have successfully imported a csv file and created a table. However, I cannot select anything from the table. My code is: SELECT * FROM transfers; Error message is: ‘utf-8’ codec can’t decode byte 0xc3 in position 0: unexp…