I have a table called mov_entrys and they have multiple historic records, in other words, duplicated records this is my main SQL statement SELECT me.mov_entry_id, me.mov_entry_ean13, me.plate, mv….
Tag: sql
PostgreSQL missing FROM-CLAUSE entry
I have the following query: It tells me: ERROR: missing FROM-clause entry for table “sb.bookings” LINE 2: SELECT “shiftId”, “sb.bookings”.”state”, “visibleAt” FRO… I wrote it as “sb.bookings”.”state” because state is in …
Provide the values for a ‘like’ function from a specific column in a Table?
I am using SQL Server 2014 and I need a T-SQL query which uses the like function to run on a specific column (c1) of a Table (t1) to find out if it contains one of the codes from a list of codes found …
How do i crack this SQL Soccer Matches assignment?
I came across this problem recently, i’m a sql newbie preparing for an interview and i need some help understanding how to connect the tables without using joins (since there is no common column)to …
Unknown column in field list when use join MySQL
I have 2 tables like this: product_master: campaign_product: This tables link with foreign key product_id I want to get all product data with campaign_code column. I don’t want to get 2 campaign_product row with same product_id. So I use this query: It got error when I run: Error in query (1054): Unknow…
How to SUM columns in the same row?
I have a table like below: id pymt_no1 pymt_no2 pymt_no3 pymt_no4 pymt_amt1 pymt_amt2 pymt_amt3 pymt_amt4 25 100 5 150 50 …
Reverse order of every other character in a string
I’m currently working on a project where the data I’m receiving is being given to me in a messed up order. I need every 2 characters to switch places in a string. Currently I have the below code, but it is ungodly slow in a function or stored procedure. Any help would be appreciated. Ex: FK741 OCE…
problem with script creating table via if clause
We are trying to build a script which automatically checks if a table is already created and if so the script should end. If the table is not created the script should create it. case if …
Equivalent of string contains in google bigquery
I have a table like as shown below I would like to create two new binary columns indicating whether the subject had steroids and aspirin. I am looking to implement this in Postgresql and google bigquery I tried the below but it doesn’t work I expect my output to be like as shown below Answer Below is fo…
I need a Row_number over partition to achieve this in SQL Server
I have three columns PID, AppNo and ProcessedDate I need a query to update the AppNo in the format below PID AppNo ProcessedDate 11 1 09/30/2019 18:21 3 1 09/25/2019 08:37 3 2 …