I have two tables: ChatRoom Id (int) ChatUser (where i insert the users to the chat room, 1 row per user) RoomId (int) // Id from table ChatRoom UserId (int) I want to loop out all rooms where im in i do like this. But how do get the room id where the second user with the variable userId2 exists?
Tag: sql
How to get the return value from EXEC(Query) inside stored procedure
Is there any way to get the return value from the following SQL script? The @ColumnValue will be 1 or 0. I am expecting single value from @ColumnValue. I want to check if the @ColumnValue is NULL or not. If Not Null, I want to update a table with this @ColumnValue. Thanks in advance Answer If you update table…
How to compare two strings based on percent match in SQL
I want to post a solution to a interesting problem I was facing in T-SQL. The problem: Compare two string fields based on a percent match. In addition, the two strings may have the words in them translocated. For example: “Joni Bravo” and “Bravo Joni”. These two strings should return a…
Creating data entry form using button VBA
I am trying to create a basic data entry form, however, it is turning into more trouble than I anticipated.. I have the form created, now I am just trying to INSERT the data into the DB (TEST). I am receiving an “Object Required” error. Any suggestions? All of the txt boxes are verified to be corr…
Copy data from one column to other column (which is in a different table and different database)
I want to copy one table column value to another table. But both are in different databases. I did this but UPDATE dbo.Excelimp.Furniture SET dbo.Excelimp.Furniture.AssetId = dbo.Sample.FADetailsNew….
MySQL aggregated sum of JSON objects
I have created new table and having details as JSON datatype. I tried to get the aggregated sum of all records. I can able to get the each values but I don’t know how to get the sum using group by …
Rename Column in Azure Data Warehouse
I know I can accomplish my objective with this process: Create new column Update new from old Drop old I am looking for a way to do this with one command. I know that remane object works at the table level. For example, I can do this: But these all fail with various error messages: Plus, according to this, sp…
SQL NOT EXIST returning duplicate value in query results
Hi Seem to be getting duplicates from this sql code it suppose to find records on BO Data that is not on Order Data by using the following as a key Keyorderstatus all my query results are on the Order Data already, How can a remedy this issue? Answer As @dfundako said – hard to check without data tables…
Oracle parameterized update query c#
It should work but it doesn’t. I have referred others but couldn’t find the reason. Thanks in advance. Joon Answer I found why it didn’t update table. To make it work I added parameters in the order of the query parameter and found it works. But I still do not understand why the order of add…
selecting from the table where the display_start date is minimum
This is what I want though can’t find the proper syntax. eg. Answer As per your requirement you can use below one