Skip to content

Tag: sql

Invaild use of group function

I am trying to make an after insert trigger that will add the bnumber to the table available with the rack-id that has the most open slots. To get this I need to take the total number of slots – the number of instances and if there are no free slots then the insert will fail. Below is what I

PIVOT with 3 tables and JOIN without number values

Hope someone can help me or point me to the right direction. I’m more of a beginner in sql language. I have 3 table users, dataTypes and usersData I only managed to use join on three tables like this: That gets all the entries for every single user like this and then repeating multiple times the same us…

update average/count from another table

I’ve been provided the below schema for this problem and I’m trying to do two things: Update the ACCOUNT table’s average_eval row with the average of the evaluation row from the POST_EVAL table per account_id. Update the ACCOUNT table with a count of the number of posts per account_id, with …