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 inActUse…
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.…
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…
convert access group by query to sql server query
I’m unable to convert MS Access query to SQL SERVER Query, with changing the group by columns because it will effect in the final result. The purpose of this query is to calculate the Creditor and …
How to display a SQL Query that returns multiple rows in Java
So I have a SQL Query that returns multiple rows and columns of information but I am having trouble displaying more than a single row in a textArea. The code below correctly displays the first row of …
Postgres, how to limit number of rows returned from joined tables
I have the following query that return the data I want, however for the joined tables, I want to limit the number of rows returned and preferrably be able to specify for each joined table. I tried …
Is there a way to use MySQL fulltext to search related tables?
I have a table called persons which contains data about, well, people. It also contains foreign keys to another table. I’d like to make a fulltext index that is able to search the related tables for …
SQL Query – How to apply different conditions (Where clause?) to specific aggregated columns
I have a table (simplified example below) consisting of TEST(s), TESTPRICE per test and TESTSTATUS. I would like to be able to run a query that will result in two aggregated columns, one for pending …
How to calculate weekly and monthly appearances of distinct string values in SQL Google Big Query?
I am new to SQL, and I have a dataset with date values and domain column. Domain column only contains values ‘personal’ and ‘business’. What I am trying to accomplish is to calculate weekly and …