This is the code I’m working on it to insert an image into database. I think there is nothing wrong with the first part. However, somehow this code is not functioning as it supposed to (no image …
Tag: sql
JPA distinct inner join with Condition on joined table
I have two tables below: I want to get the college object with list of students of a specific department. The SQL query is below: So far I have tried the below JPA query but it is returning multiple College objects. How to return a single college object with list of students with filtered department? NOTE: I can’t alter the
How to add a comment to flyway migration
I am trying to make my big migration more self explaining and that’s why I need to add some comments to it. However, I tried a few approaches and haven’t succeeded with them. I tried: // # <!– TEXT –> Error: Is there a way I can add a comment to flyway SQL migration? Answer The following should work on
How to update each row that shares the same id differently in postgresql?
Hope this isn’t too hard to explain. I need to update the first table with addresses from the second So basically I have mytable1 that has the following columns: id (pkey) | super_id | address …
Is it possible to remove duplicates from the result for the data set?
I have two following tables, dim_customers and fact_daily_customer_shipments: dim_customers +————-+———————–+———————+ | customer_id | membership_start_date | …
Hive like does not work when the string is from other table
I meet a strange problem in hive The table a: The table b When I use: It works well But when I use I got return null. The b.domain is ‘%taobao\.com%’ or ‘%tmall\.com%’. What’s the different using them direct in SQL query? What makes the second query failed? Answer Without ‘\’ in the template it works fine: Result: And the
Split single row into multiple rows based on Date and time in SQL Server
I want to split a single row into multiple rows based on time. below are the example. Expected output is below: Day start from 06:00 AM to next day 06:00 AM. When EndDate time is grated than 06:00 AM then split this date in two rows. first row end date is 2018-08-21 05:59:00.000 and next row start 2018-08-21 06:00:00.000. Answer
SQL BCP Unable to insert value for identity column
I am using bcp utility to import a tab delimited file. My table has an identity column, when I run bcp command I get error as Error = [Microsoft][SQL Server Native Client 11.0] Invalid date format Second column is datetime. When i use -E flag (as suggested by many), I get error as Error = [Microsoft][SQL Server Native Client 11.0]
SSRS : How to make a data set field appear in the footer?
I have a simple report with a dataset( Patient id, programid, name, address, phone). In my report footer, I am trying to write a condition where the footer value shouldn’t show up for specific program …
I have a result set of continuous days and a severity rating. I would like to aggregate these into StartDate, EndDate, Severity
In SQL Server I have a table with the following data Date Severity 2018-09-10 40 2018-09-11 40 2018-09-12 40 2018-09-13 40 2018-09-14 40 2018-09-15 40 2018-09-16 20 2018-09-17 20 2018-…