Skip to content

Tag: mysql

SQL Query creation with multiple joins

I am working with MYSQL, and want to create a query. I have 3 tables. QUESTION QUESTION_NUMBER QUESTION_DESCRIPTION 1 anydesc 2 anydesc2 ANSWER ANSWER_NUMBER ANSWER_DESCRIPTION 1 anydescANS 2 anydesc2ANS 3 anydesc3ANS And a bridge TABLE QUESTION_ANSWER Q_NUM A_NUM 1 1 2 2 2 3 Now I want to retrieve all the An…

How can I make the trigger return a value?

I have a ‘roomstate’ table that represents states that I keep updated. This is what happens when the employee assigns room 2 to customer 1 whose booking_id is 2. As the table above is continuously updated, the existing contents may become NULL again. I’d like to have a record of updating thi…

optionally enclosed not working, commas breaking upload

I have this table: Here is my load statement: In spend I’ll have a decimal value with a comma like: 1193.72. The spend field gets uploaded as 1. The impressions field that follows is correct and unaffected. Example record: 1/19/2021 | 1,193.72 | 92780 Output: 1/19/2021 | 1 | 92780 I was under the impres…

SQL subquery in SELECT clause

I’m trying to find admin activity within the last 30 days. The accounts table stores the user data (username, password, etc.) At the end of each day, if a user had logged in, it will create a new entry in the player_history table with their updated data. This is so we can track progress over time. accou…