i have return XMLTYPE after pivot xml that looks like Ukraine 12345
select sum where condition is true and count > 3
I have two tables. FootballPlayers with columns Id_footballplayer, Last_Name, Fisrt_Name, Age Transfers with columns Id_transfer, Name_club, price, date, acceptance (yes or no), code_footballplayer How can I write a SQL query to select the last names of the players and the sum of the successful transfers carr…
How to JOIN postmeta table and get the posts before the date of custom field using SQL
I’d like to combine wp_posts table and wp_postmeta table and get the posts before the date of custom field. Code with only wp_posts table is below and it works fine I want to add “postmeta table” to “post table” and get only posts before the date of custom field if it is “W…
use concat or replace for values in the middle SQL / Postgresql
how to use concat for values in the middle, I have the following data and I want to change it to be like this I tried with a query like this, but the results did not match what I expected this is the result of my query Answer You can simply use
SQLDateTime OverFlow with Correct DateTime Format
below is my code snippet where I insert a DateTime value to SQL database and encountered the following error: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. May I know if there is a format to be used? when converting the value of r…
Selecting default row if no rows return with join condition values from other tables
I have two tables ORDERS and RATE: and I would like to get the costs of all the orders in table ORDERS, given that a default rate of 10 is used for those orders which do not have rates in the RATE table for the corresponding ids, and if an id is available in the RATE table, but no rate
SQL Get Parent when child is column is 0
I have two tables below. Data: Using joins I have got the information from both the tables which have needed, but in a new case I need to extract the Address like if the IsNetwork = 0 then Address should of it’s the parent. Following is the query of join This is the output of that query: I want the
Dynamically frame Filter condition based on conditions
We have separate table maintained for condition / filters. Based on the conditions, filters to be applied at base table. here’s the sample input conditional data for reference purpose Based on this input conditions , filter to be derived as follows. please help me in achieving the filter query Answer Th…
Retrieve the first occurrence of a record by ID in SQL
I am trying to import some data into Excel from a SQL server, but I am having some issues. It’s my first time writing a query, although I am able to get the entire dataset, I have realized that the data is full of duplicates. I want to get rid of duplicates in Excel and only keep Unique records. I
Postgresql Select and display one column based on another column
WALLET TABLE ID IS_SPEND HOWMUCH true. 500 false. 1000 true. 5 I want to calculate how much money I have after several transactions. spend as spend money and not spend as earn money I tried But it cannot reach my goal. I don’t know how can I get the result I want, just output 495 is perfect. Answer You …