All Questions
14,011
questions
0
votes
2
answers
48
views
MergingTwo SQL Queries Select and Count in Single statement
I am Working on project, where I am using two queries to get the result i wanted to process.
Query 1
SELECT MID FROM PMS.MACHINE WHERE STATUS=1 AND MID !=0;
Query 2
SELECT MID,COUNT(STATUS) AS QUEUE
...
0
votes
0
answers
12
views
Can't seem to get the date parameter to work
The following query works when I don’t add the last AND statement with the dates. However, when I add it, no results are found. I know this isn’t true because I populate data into the engine and know ...
0
votes
2
answers
42
views
How to exclude lines where a data is being referenced in another column SQL
I need help with a problem to exclude matching rows.
I have a table that has multiple columns,this table refers to a travel, the rows can contain data to a full travel, the first part of the travel or ...
1
vote
3
answers
103
views
How to move the last row to the top in a table in MySQL?
I have a row in the following table which is the first row but added to the table at the end and now I'd like to modify the table in a way to show employee ids in order starting by number 1.
Issue:
(
...
0
votes
1
answer
83
views
How does SQL Server allow multiple of the same alias in the same SELECT statement?
I was doing some queries with Dapper and came across a use case where I needed to return different columns using the same alias to be able to map into different objects with the same property name e.g....
0
votes
1
answer
69
views
Need help in using SQL split by delimeter, and get data from another table from the results of split data [duplicate]
I have 2 Tables
Table -1
Soltid
SlotName
Amount
1
Slot-1
100
2
Slot-2
150
3
Slot-3
150
4
Slot-4
125
5
Slot-5
100
6
Slot-6
100
7
Slot-7
150
8
Slot-8
125
9
Slot-9
100
10
Slot-10
150
11
Slot-...
0
votes
1
answer
41
views
I have a query that outputs 5-6 different counts with union statements. Is there a way I can add row labels to each one? [duplicate]
The code snippet looks like this
(select count)
union
(select count)
union
(select count)
union
(select count)
union
(select count)
And the output is:
Count
291
3563
44
1
246
8123.
Is there a way I ...
1
vote
1
answer
105
views
HAVING Count clauses with conditions?
Say I have a table with orders stored in it. Those orders have an OrderType column indicating what kind of order it is.
Those orders also have a column indicating which orders should be grouped ...
0
votes
2
answers
37
views
Select records not in subquery, returns nothing
I have a table with customers and another with documents, I want to get all customers that don't are in the subquery having document type 2
SELECT * from contactos
WHERE NOT EXISTS
(SELECT * from ...
0
votes
1
answer
51
views
How to select several values into variables in PLSQL
I have this statement:
SELECT parameter,
VALUE
FROM TABLE(my_db.workplan.get_pp_params(in_pa_nummer => 'NR04640992', in_par_typ => NULL))
this is what I get back from the statement:
...
1
vote
1
answer
42
views
Select SQL statement on same column
I want to select distinct count(id) as activeusers from a table where useractive=1, but at the same time I want to select all the users example distinct Count(id) as totalusers regardless of ...
1
vote
2
answers
113
views
Always returning Null: Using Select Statement in creating a function in oracle SQL developer
FOR ANYONE HAVING THE SAME PROBLEM, I WAS ABLE TO SOLVE THIS BY REMOVING '_' IN MY VARCHAR2 PARAMETER NAME
I need help in this, I've been stuck in here for too long. I have tried multiple things ...
0
votes
1
answer
41
views
How to filter out orders with zero dollars in sales in SQL?
I'm trying to filter out orders that have $0 in sales but I'm somewhat new to writing SQL code so I'm not exactly sure how I would go about writing this. I'm more familiar with writing DAX, which in ...
0
votes
1
answer
53
views
SELECT adding row with custom text to query
I would like to join multiple Tables add a dummy leading row additionally to my SELECT query with some custom Text for each queried field.
Is there a way to do that?
(bla is the custom text in the ...
-5
votes
1
answer
73
views
How do I write a query for inner join [closed]
I want to write a select query that shows me first_name, last_name and the management_name. Each employee row has a management column, which is equal to the employee_id of the manager.
This is what I ...