I have worked a bit in pivot/unpivot in Oracle SQL but this one seems little complex and need some help here. the below is my table design year Comp_A_prev_yr_due_ct Comp_A_prev_yr_due_amt Comp_A_curr_yr_due_ct Comp_A_Curr_yr_due_amt 2019 100 1000 101 1001 like this I have multiple companies as columns (each …
Tag: sql
How to proprerly bind text to a SQLite prepared statement with sqlite_bind_text
If the following SQL using the sqlite3_prepare_v2 is run, it generates the expected results. select id, path, name from media where id in ( select media_id from media_tags where tag_id in (…
Generating dynamic data using join select query in Oracle
We have a select query containing around 10 tables. using that query we are getting just 50 record. We need to get 50k record. actually we dont have functional understanding to generate data into these tables. Is there any possibility, we can create insert query to insert data into these 10 table using that s…
How to get value from a query of another table to create a new column (postgresql)
I am new to postgres and I want to be able to set value to Y if order (order table) is a first month order (first month order table) first month order table is as per below. It will only show the order placed by user the first time in the month: order table is as per below. It shows
Connecting to multiple MySQL database in single php app [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I’m trying to connect multiple mysql databases to a single php web app. I’d…
In SQL query (BigQuery) How get all rows where CreatedDatetime is Today in Moscow tz from column with UTC tz?
I have a table with CreatedDatetime column. This column is in UTC timezone (Values look like this: 2020-12-20 01:00:00 UTC). I need to get all rows where date is Today, but in Europe/Moscow timezone, which is +3 hours. Instead I need something like this: Answer In Bigquery, you can convert an UTC timestamp to…
SQL query for report by name with many columns count by status
Is it possible by sql query to produce a report group by a name with count by status. Tables: Project (id, name, status_id, service_id) Status (id, name) Service (id, name) I need to make a report, count by status group by service: Columns results: Service name, status name 1 , status name 2, status name 3, t…
Get word frequency rankings of words in postgreSQL and filter by label
I have a postgreSQL database with the following table: The following data is inserted: I have the following query that fetches the frequency of each word in the table and ranks them, grouping by day: Result: I would like to group by the label so that the new query shows the word rankings filtered by label lik…
Find rows that have the same value on a column in asp.net
I have an issue I want to translate this SQL query int asp.net. there is a relationship between student table and teacher table many to many and I want to display students that have more than one teacher and that what I trying to do in asp.net Answer You can try out both ways. Using Lambda Expressions Using S…
Incorrect syntax while accessing SQL table using Python
I’m trying to access a SQL Express database using Python, but I keep getting an incorrect syntax error. I’ve tried a few variations based of other examples I’ve seen, but nothing’s working. The error is pyodbc.ProgrammingError: (‘42000’, “[42000] [Microsoft][ODBC SQL …