Skip to content

“recursive” query in postgresql

this is my current query : SELECT id, name, CASE when geolocation=” then (select geolocation from location where id = q1.parent_id) else geolocation end FROM location q1; …

SQL Query to determine number of tables

I have this table and I’m trying to determine how many Tables (in a restaurant) are awaiting food. The table( in the database) has the following columns: TableNumber, ObjectType, ObjectDescription and Quantity (amongst others). I made this query to see what is ordered, but would like to know how many un…

XMLTable query returns no result

I’m only passingly familiar with XML. I need to parse a response from a SOAP request. From a lot of searching, I’ve developed the following query to try to extract the status. Ultimately, I’d like to get the status, cntr and cntr_status fields from the response. My query gives no error, but …

match against doesn’t work with the word “when”

When desc contains the string: zoom when wifi dies for 1 second Query 1: No problem, I get the row! Query 2: No results! So when belongs to sql commands. So how to solve this? Answer You need to learn some basics about full text search. One very important concept are stop words. These are words that are not i…

Oracle select column names dynamically from another table

I have two tables. Lets say tab1 and tab2. tab1 has data like this: ID Field Name 00001 col1 00001 col63 00002 col3 00002 col47 00003 col22 00003 col40 Each ID has always 2 Field Name values. And tab2 has columns col1,col2,col3,col4….col70 I want to select columns dynamically from tab2. Like for 00001 i…

Select some datetime from base

I have a 2 table in my base. The first table is reservation table. The start_ts and end_ts are time when start and end the reservation of desk (desk_id): [Reservation_table] The second is motion, which come from sensors motion. [Motion_table] This 2 tables are connecting that the sensors are start save to the…

how to sum two columns from different tables MySQL

I need to sum the data from two different columns located in different tables and grouped by session_id….. I need to sum the column of spent_points + price_points grouped by session_id this is the result i hope to get I have tried with this query but I have only managed to group the data but I have not …