My main objective is to transfer some data from excel to SQL server while using vba but in the process I would like to detect and avoid transferring some duplicate month columns. This is what i have …
Tag: sql
Django annotate add interval to date
I am using postgres database with Django 2.2. I need to combine date and time field in model and add an interval of one day in it. I have done first part like this. Model.objects.annotate( end_dt=…
PostgreSQL – why is this statement causing a syntax error?
SELECT (SELECT COUNT(*) FROM table1) AS count1 WHERE date=’2019-06-12′, (SELECT COUNT(*) FROM table2) AS count2 WHERE date=’2019-06-12′ why is this statement causing a syntax error at …
SQL – Search ‘Address’ Where Contains string parameter
I have a stored procedure which locates the specific address. Fields City Province Zip code Records City : Manila, Makati, Cebu City, Kawit Province : NCR, NCR, CEBU, CAVITE Zip Code: 1111, 2222, …
Reformatting SQL output
I have data that looks like this Name XX YY alpha 10 77 beta 10 90 alpha 20 72 beta 20 91 alpha 30 75 beta 30 94 alpha 40 76 beta 40 95 If I use select * from scores order by Name, XX I will …
How to fix, where condition with update not working
I am trying to update my table using where condition. I am not sure where I am going wrong. I am using peewee for SQL queries in python. I am trying to update two different tables having the same …
How to omit html tags in a mysql table attribute while doing a select
I have a table where each row consist of an attribute which consist of html data with like this. I need to omit the html tags and extract only the data inside the tags using sql query. Any idea on how to achieve this?. I tried out different regex but they didnt work. Answer There are 2 solutions based on
Creating bins in presto sql – programmatically
I am new to Presto SQL syntax and and wondering if a function exists that will bin rows into n bins in a certain range. For example, I have a a table with 1m different integers that range from 1 – 100. What can I do to create 20 bins between 1 and 100 (a bin for 1-5, 6-10, 11-15
Find the longest streak of perfect scores per player
I have a the following result from a SELECT query with ORDER BY player_id ASC, time ASC in PostgreSQL database: I’m trying to find each player’s longest streak where points = 100, with the tiebreaker being whichever streak began most recently. I also need to determine the time at which that player…
Extracting Numeric values from a column (VARCHAR) based on a preqrequisite
I currently access a table view from SQL server and write custom SQL query to retrieve/filter/create custom column as per my need before exporting. Now in that view one of the columns have text value as following Now all I want is to create a custom column which would extract all the numeric values and –…