Some days ago I asked the following question: How to select records with zero associations from two has many? I failed to adapt the answer that solved my previous question to this similar situation: …
Display lookup/relational data in a v-data-table with Vue and SQLServer
I created a Node App with Vue.js, Vuetify (Client side of app) and Express (Server side of App) and the data is stored in a SQL Server database (relational database). Everything is up and running on …
How to transpose NULL value to 00:00
I have a view that gets data from an internet database. The view I created works, but when there is no data (NULL) I need it to return 00:00. How can I achieve this? Using SSMS I am getting the starttime of booked resources. I already get them in the right way. But sometimes it returns NULL. I searched the
SQL group two value in a same row
I have this query SELECT to_char(timestamp_arr,’Dy DD/MM/YYYY’) as timestamp_date ,to_char(timestamp_arr,’DD/MM/YYYY’) as link_date ,count(transport_uid) as value ,…
Insert into sql server table, using subquery returning more than 1 value
I have the following tables table1 table2 table3 I want for every id in table2 where condition is true, to insert 2 rows in table1. The rows should have the table2.id and table3.id ( for all ids in table3) Here is my script so far. The expected result should be something like this: table1 id | w_id | w_check_…
SQL – FOR XML – How to add property to tag
I have the a stored procedure to generate an XML document based on the UBL-TR-2.1 standard. This is the query where the xml data is generated: A sample output of this query is this XML file: This works so far so good. But now some XML elements shall have attribute in the element itself. One example is: How ca…
How to Compare COUNT of Groups in Percentage in SQL?
I really new to SQL, currently learning PostgreSQL. Suppose I have the following schema: class(class_id, school_name), primary key: (class_id) enroll(student_id, class_id), primary key: (student_id,…
Why does SQL Server read uncommitted data when the default isolation level is READ COMMITTED?
You have a dbo.inventory table and the itemsInStock is 10. Let’s say you run this query: (and you don’t commit the transaction) Why is SQL Server reading a 5 if it hasn’t been committed yet and the default isolation is read committed? Answer Obviously a transaction needs to see everything it…
Get room members, room’s owner and admin at the same time in one query with grouped by id (unique) on PostgreSQL 12
I want to get room’s member list, room’s owner member in case of he doesn’t exists in other table and admin member at the same time. Currently i fetch them individually. CREATE TABLE public….
SQL – create SQL to join lists
I have the following table: Add Data: Find users who share addresses. Expected Results: Question: How do I formulate a SQL query to obtain the expected result? Much appreciated. More info: PostgreSQL 9.5.19 Answer I don’t know if this is the most efficient method, but I can’t come up with somethin…