Skip to content
Advertisement

Tag: sql

How query two different Sum from the same table for the same column but with different condition?

I would like to fetch the sum of field TOTAL for active users and sum of field TOTAL for inactive users. Expecting is the query that results activeTotal = 15 and InactiveTotal = 50 SELECT SUM(actUser.total) as activeTotal, SUM(inActUser.total) as inactiveTotal FROM user actUser JOIN user inActUser ON inActUser.id = inActUser.id WHERE (actUser.active = 1 AND actUser.userId = 1) OR

How to change max_connections_per_hour in XAMPP?

In my production environment I’m getting this error: I don’t have this problem in my development environment so I need to set the max_connections_per_hour to 500 in order to replicate it. How do I do this? My database is run from the XAMPP control panel. I don’t see this variable name in my.config, which is also accessed from the XAMPP

Get users attendance entry and exit in one row SQL Server

I have a table with all entries for employees. I need to get all the working hours and the entry and exit time of the user in one record. The table is like this: How can I do that and also in case there is some missing entries or exit. Like one employee will have entry with no exit in

PostgreSQL cyclic foreign keys to multiple tables

I have 3 tables. chat_room group_chat_room private_chat_room As you can see chat_room has foreign key constraints that refer to group_chat_room and private_chat_room. Also both group_chat_room and private_chat_room have FK constraints that refer to chat_room. When I want to INSERT a row into group_chat_room I would use this However because of those constraints this would produce an error [23503] ERROR: insert

Advertisement