返回首页

Questions tagged [sql]

Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Objects exposing columns with CLR types are not allowed in distributed queries

Working on query to connect between server and client machine without creating linked Server. Query is about to select rows from given table as shown below: EXEC sp_configure 'show advanced options',...
-2
votes
0answers
18 views

What is the efficient way to store huge hierarchical (10k) records with 20 depth (level) in the database?

I used recursive CTE to get hierarchy level data from the database. It works fine for upto 1000 records with few depths. If the depth and record increases it takes more time and some times it throws ...
0
votes
0answers
5 views

BCP update database table base on output from powershell

I have 4 files with the same csv header as following Column1,Column2,Column3,Column4 But I only required data from Column2,Column3,Column4 for import the data into SQL database using BCP . I am ...
0
votes
0answers
11 views

How to avoid space issue during query execution in postgresql?

This is in continuation of one of my previous post which was about performance. But this time I got an error message. I am just trying to join 9 tables. Please note that am able to join 8 out of 9 ...
0
votes
2answers
32 views

How to check if json array already contains a certain key?

Let's say I have this json in my jsonb column { "fields": [ { "name": "firstName", }, { "name": "lastName", }, ... } How can I know if the "firstName" already exist?...
0
votes
0answers
8 views

TypeORM One-To-Many and Many-To-One relationship with share table

I'm using typeorm and having a problem with these relationships. The problem is with the attributes entity. @Entity('Attributes') export class AttributesEntity { @PrimaryGeneratedColumn() id:...
0
votes
0answers
13 views

Postgres Dump Selected Rows

I have a database that has a central object that most of the data depends on; many reference table, one to many joins and many to many joins. I need to back up all rows based on a property in the ...
0
votes
3answers
47 views

Stored procedure that takes in a dynamic number of joins

I am trying to build a stored procedure that takes in a dynamic number of tables and joins them. SELECT a.Account FROM Database.Accounts a JOIN (SELECT Table_Name FROM Database.TableStrings WHERE ...
-1
votes
0answers
12 views

Having error with prepared query and bind param (PHP/SQL)

Im having some issues with the sytnax of my sql code. I really don't know where's the error, any idea would be very appreciated. Here's the error message: Error: INSERT INTO incidents (name, ...
-1
votes
2answers
22 views

SQL Select Max Count Nested?

SELECT N.National_PosID, N.Title, C.First_Name, C.Mid_Name, C.Last_Name, count(*) FROM National_Position N, Candidate C, Vote V WHERE N.National_PosID = C.National_PosID AND V.Candidate_ID = C....
0
votes
1answer
18 views

SQL Server split counter into 2 parts for same column?

After a lot of time wasted trying to get this query to work, I come here to seek for help. I have a set of data that I want to count. But I want to count into 2 separate columns based on a condition ...
2
votes
0answers
16 views

Criteria API read data in chunks with NOT IN statement

I am using EclipseLink 2.6.4, Java 8 and DB2 for database. I have to write query to read data with NOT IN statement providing a large set of values for NOT IN statement. Basically I have set of ...
0
votes
0answers
6 views

Error in creating connection in Oracle SQL Developer using localhost; Listener refused connection

I've already created a database in SQL developer using my localhost. And tried to connect it remotely in other PCs. But today, I wasn't able to connect and it's giving me error An error was ...
0
votes
1answer
19 views

How can I use Java in React application with MySQL for the database. Any suggestion?

The front end I want to use React and the backend Java with Mysql for the database.
0
votes
0answers
19 views

SQL / Oracle SQL Code for looking data from other tables

How to write query to get data from other table for each columns in existing table.
0
votes
0answers
16 views

If there are duplicate values in one column, how do I select a row based on the data in another column? [duplicate]

I need to find earliest submission date for each unique email. This query, gives all records. SELECT distinct [email],[Submission Date],[field 3],[field 4],[field 5] FROM table order by Submission ...
0
votes
0answers
12 views

How to return OHLCV for each stock in a result set

How to select a list of stocks (AAPL, MSFT, etc) and return Open, High, Low, Close, Volume per day for EACH. I've looked into temp tables, cte's and joins but am not sure which approach nor even if ...
-1
votes
0answers
29 views

How to write a T-SQL Script or CTE [on hold]

I need to compute the percentage increase in the quantity of bikes sold between 2005 and 2008 for male and female customers (i.e., by gender) who live 2 miles or less from where they work. Not sure ...
-1
votes
1answer
35 views

SQL logic for inner join on (A AND B) OR NOT B

I am looking to do an inner join as follows: SELECT a.Account FROM TableA a JOIN TableB b ON (a.Account = b.Account AND a.Source IN (SELECT Source FROM TableC)) OR a.Source NOT IN (SELECT Source ...
1
vote
1answer
26 views

Filter over duplicate records

I'm trying to identify a distinct list of person_id that have the same account_id as another person. The caveat is the person_id who was last given the overlapping account_id should not be included ...
0
votes
0answers
8 views

How to query a remote database with a powershell command?

I've done some research and I found the command "Invoke-Sqlcmd". I believe this is the command I want to use, but not which arguments. I've tried multiple things, but keep getting "invoke-sqlcmd : ...
0
votes
1answer
24 views

Search by composite field at the View

I have a view in my SQL Server database. One of the columns in this view is the composite column. ng.NAGS_GLASS_ID + ' ' + npp.GLASS_COLOR_CD + npp.ATCHMNT_FLAG AS PART_NUMBER So, `Part_Number field ...
0
votes
0answers
16 views

Query to execute value from column in table

I have a table with sql as the column value In one of the colum. I need to run that sql and need to save the result in next colum in the table. Eg Column1 column2 column3 column4 1 , table1 , ...
-2
votes
0answers
11 views

How get data from RSLinx and send to SQL Server through Visual Basic or C#?

I have a question: can I write a program in VB or C# that gets data from RSLinx and sends it to SQL Server? I have searched but only find information with programs with cost. I'm new in this. Does ...
1
vote
3answers
33 views

Psql - generate series with running total

I have the following table: create table account_info( id int not null unique, creation_date date, deletion_date date, gather boolean) Adding sample data to it: insert into ...
0
votes
1answer
24 views

SQL I need to extract a stored procedure name from a string

I am a bit new to this site but I have looked an many possible answers to my question but none of them has answered my need. I have a feeling it's a good challenge. Here it goes. In one of our ...
0
votes
0answers
16 views

Rename Chart AxisLabel C#

I am trying to graph a history of expenses but I cannot change the texts of the axis labels from this table: Actually I have this code: public void GraficarAdmin(Chart grafico) { ...
-1
votes
3answers
38 views

Query gives me a syntax error in From clause error

This SQL query runs perfectly in an older MS Access file but after recreating it for a newer table it gives me a Syntax error in the from clause. select * from ( with dso as (select year, month, ...
1
vote
0answers
24 views

Matching model to ForeignKey based on Foreign Model's date range

Say I have two models. class ModelA(models.Model): name = models.CharField(max_length=200) start_date = models.DateField() end_date = models.DateField() def __str__(self): ...
0
votes
1answer
15 views

How to send variable to sql request from app android

I try to get nearby Location from my database to my aplication but I dont know how send variable $lat and $lng with my request. All work fine I just need to put the variable for get nearby location. ...
0
votes
0answers
28 views

Is there a way to set an alias dynamically (i.e. result of another query) in SQL (MySQL 5.7)

I'm trying to create SQL views for some reports, and because it's only for reporting needs, I cannot change how tables are set. I need to be able to name columns based on the result of another query, ...
0
votes
2answers
27 views

Full Outer Join Not including all records from both sides

I have a calendar table with dates from 2000 through 2029. I have done a full outer join with my data table on date=tdate. My goal is to count trips occurring by date and to show a zero if there are ...
0
votes
0answers
9 views

TM1 escape double quotes in sequence

I have a TM1 record i am trying to put through SQL loader but i get sql loader error due to the double quotes in the field: "this is test ""name"" hello" When i use TM1 SetOutputEscapeDoubleQuote(...
1
vote
1answer
28 views

Querying records based on join not returning expected results

I am trying to write a query in MySQL that retrieves subscription records, based on the expiration column of joined transactions. A subscription can have 0 or more transaction records, and ...
0
votes
1answer
9 views

hh:mm:ss date format in MDX

How can I get current date on hour-minutes-seconds (06:13:47) format in MDX? I'm trying to create a 'New Calculated Member' on the 'Calculations' Options inside the Cube used. CALCULATE; CREATE ...
0
votes
1answer
36 views

Sql query to delete duplicate rows

I have three tables. Diagnose, Patient and PatientDiagnose The tables look like this Diagnose: uuid,text,date Patient: uuid,name PatientDiagnose: patientuuid,diagnoseuuid One patient can of course ...
0
votes
0answers
14 views

Create table with values from CTE based on rowid

i am fasing a situation when i want select some data to created table. This data must be in joined between 2 tables based on a rowid. I know this can be done like i wrote, but it's not a correct way. ...
-4
votes
0answers
28 views

What request will be correct here? [on hold]

The task is: create a request that will display the largest payment for the day when the amount of payments was the largest. Most likely, the task does not imply the use of LIMIT. The topic before ...
0
votes
1answer
31 views

Difference in values

I have a table with values similar to image 1. I want a column which gives the difference between High values and Low Values keeping the medium values same as the difference. Please let me know if ...
0
votes
0answers
12 views

Jira Software 7.1.2 - Sprint ID from AO_60DB71_SPRINT does not match the IDs on CustomFieldValue

I'm currently on a project where I need to develop some analysis using the Jira Software database. We have Jira 7.1.2, and it is installed on Oracle. I did some research and found out that the Sprint ...
0
votes
2answers
30 views

Copy SQL Server table into a txt file before delete it from SQL Server

I have a stored procedure that deletes some rows from a database table. I need to copy data to a text file before the delete operation, in order to check what has been deleted - how do I do that? My ...
2
votes
2answers
18 views

Get next value for each of values from next table CTE

I have the following table: dbo.split Name Time Alex 120 John 80 John 300 Mary 500 Bob 900 And then another table dbo.travel Name Time Alex 150 Alex 160 Alex 170 John 90 John ...
1
vote
1answer
35 views

SQL - Show Only Consecutive Rows That Meet Criteria

Here is a sample database table. I want to write a SQL query that returns a table that shows all the data but filters out cars that never have an E for status (So A1 below should not show up in the ...
0
votes
2answers
25 views

Azure VM Database

I just got finished creating a VM in Azure and called it vm123. I was trying to use that VM when creating my SQL Server. When I create a SQL Database in Azure, it forces me to either create a server ...
0
votes
1answer
49 views

Validate that only one value exists

I have a table with two relevant columns. I'll call them EID and MID. They are not unique. In theory, if the data is set up correctly, there will be many records for each EID and every one of those ...
0
votes
1answer
21 views

How do I set up a MS Access form to create a new row in table and set one field as a default value?

So I am not positive I am even asking the correct question, but here it goes. I currently have a MS Access Form built so that someone can enter in a new work order. You are able to set the company, ...
1
vote
0answers
27 views

Extract nested XML data with inconsistent attributres and elements in SQL Server

I have an existing table with 2 columns: unique ID, data in xml format. Latter has nested structure but not standardised (see example below). Would like to extract all xml info for each ID into the ...
0
votes
1answer
40 views

Microsoft Access: Trouble taking average of groups in query

I have a database with 4 Tables: Analytical_Rooms Analytical_RoomsReserved Analytical_Reservations Analytical_Customers I need to calculate the average age of each customer by Hotel name, ...
-1
votes
5answers
69 views

I want to select only one employee from every department

My table schema and Data I want one employee from every department (EmpDepartment), for example in my table there are: 3 employees with EmpDepartment 1 2 employees with EmpDepartment 2 and 1 ...
1
vote
1answer
28 views

Automating SQL scripts in Toad for Oracle

I'm not a DBA, so bear with me. I've scheduled tasks through Toad's automation designer, but this uses Windows task scheduler. It's using Oracle 12c. How can I ensure my scripts execute on time ...

返回首页
杏彩计划 杏彩官网 杏彩APP 杏彩走势图 杏彩下载 杏彩官方 杏彩网站 杏彩怎么玩 杏彩官方 杏彩靠谱吗 杏彩代理 杏彩骗局 杏彩投注 杏彩倍率 杏彩开奖 杏彩漏洞