TLDR: I have a scalar function, that expects a table-valued parameter and returns the XML representation of that table. Now I need to use this function in a larger Update statement, where the table-parameter of the function is generated by inner Select statements. Hi, We have an XML type definition, say [dbo]…
How to insert from old table to new table using trigger in pl/sql
There is a column which calls as text (column’s name) inside a table. I want to create different columns from this column. How to insert to another table these columns using trigger. I tried few …
Simple query to join with my booking table without duplicating records for each booking
I have a customer credit table and a booking table, shown below. I’ve executed the following query which works but it’s too simple. I now need to cross join my original query to the booking table so I can check for where the booking status is completed. My second query is wrong because it SUMs the…
Getting an empty result with ‘AND’ operation and wrong result with ‘OR’ operation in SQL
I have two tables and I want to find out the customer_id and customer_name of all customers who bought product A and B both. In this example only the customers with id 1 and 3 have bought both the product A and B. To find that i wrote this code – When I am doing this I am getting an
groupby to check each of their date in oracle sql
I have a table ISIN_TBL which has two fields IDENTIFIER and ALLT_DATE which are of datatype varchar and Date respectively. There are many ALLT_DATE for each IDENTIFIER in the table. Normally for each IDENTIFIER the ALLT_DATE should be the same. But just to confirm i want to write a sql query to list IDENTIFIE…
check for EMAIL format in ROW and return value inside SELECT query
I have a table called user_data and few columns like LOGIN_NAME The column LOGIN_NAME may contain “emailformat@email.com” or just a “username” I need to know if it is possible for me to run a select query and return emailAddress if row has email type format else return userName if it i…
How to do I query all distinct rows with only their highest values?
I have been trying to query each city’s popular genre. I am only trying to get the rows that I have highlighted. I tried using MAX() on a group by but gave me a syntax error. My CTE query is as follows, its based on the dbeaver sample dataset: I tried the following query. Answer I don’t have a dat…
Execute query and populate the same in datagrid Box
I have a winform app connected to access database as data source , but in access i was using this below SQL to generate a query table called trend: But i do not know how execute this & populate the same in datagrid box on form load event(dataset:CSCdataset) , please help me. Answer I guess you can find mo…
Create a left join with raw string data
I have a list of e-mails in a text file and a Person table with an email column. I need to know which of the emails are in the table, and which are not. So I was thinking in creating a query and do some kind of left join in my raw e-mail data with the Person table. Now, I
SQL group by a field and only return one joined row for each grouping
Table data What I want to do is group by the name, then for each group choose one of the rows with the earliest required by date. For this data set, I would like to end up with either rows 1 and 4, or rows 2 and 4. Expected result: OR I have something that returns 1,2 and 4 but