Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a data in table like this :
==============================================================================================
id idPaper Code Sequential
==============================================================================================
1A506D10-9306-495A-9E4E-7081E3D3ACDB F4CFE90D-0921-4FB7-A236-5420B0892379 0036 2
3DB0FEBF-FBDF-4768-B36A-83AF4FB53E4B F4CFE90D-0921-4FB7-A236-5420B0892379 0035 1
I want display data like this :
==============================================================================================
id idPaper Code Sequential
==============================================================================================
3DB0FEBF-FBDF-4768-B36A-83AF4FB53E4B F4CFE90D-0921-4FB7-A236-5420B0892379 0035 1
1A506D10-9306-495A-9E4E-7081E3D3ACDB F4CFE90D-0921-4FB7-A236-5420B0892379 0036 2
I run my query:
select *
from tablename
where idPaper = 'F4CFE90D-0921-4FB7-A236-5420B0892379'
and min(sequential)
but it does not work. Please help me...
Thanks...
I think you just want to sort the data. Perhaps you just want:
select *
rom tablename
where idPaper='F4CFE90D-0921-4FB7-A236-5420B0892379'
order by sequential;
You can use order by.
select *
from tablename
where idPaper='F4CFE90D-0921-4FB7-A236-5420B0892379'
order by sequential
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 months ago.
Improve this question
I am trying to make a simple dashboard to get data from one sheet to show if it is greater than a week in cell B2
=QUERY('KPI 14 - 26'!A1:CC14,"select A, sum(F), sum(D), count(D)
where A is not null
AND A >= '"&B2&"'
group by A")
This code doesn't throw an error, but just doesn't display any date. If I change >- to contains it will show one weeks data. How can I fix this so that it shows all the data in weeks > week b2?
All of the data in column A on my data sheet are numbers (14 to 26)
use:
=QUERY('KPI 14 - 26'!A1:CC14,
"select A,sum(F),sum(D),count(D)
where A is not null
and A >= "&B2*1&"
group by A")
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am trying to show the total number of hours imputed by each employee in a project in SAP Business One
But as a durtype in some cases it is m (minutes) and others h (hours) I get 2 rows for employee 373
Someone can think of how I can solve this without having a SELECT above to group by empid for example
Regards
You need only one SUM() & Remove durtype from GROUP BY clause :
SELECT . . . ,
SUM(CASE WHEN durtype = 'M' THEN duration / 60 ELSE duration END) AS NumberOfHoursMade
FROM . . .
WHERE . . .
GROUP BY . . . ;
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am working with Pharmacy drug pricing data. The data resource I am using references drugs in the following format:
NDC: 0002831517
AWP: 001539667
AWP value has this format:
Decimal, 4 digits before, 5 digits after
So I would be looking to see:
AWP: 0015.39667
Whenever I use CONVERT, I get the following error:
Arithmetic overflow error converting nvarchar to data type numeric.
Any assistance would be greatly appreciated. Thank you!
EDIT: My SQL Logic:
SELECT TOP 1000 NDC10,
CONVERT(DECIMAL (9, 5), AWPUPRICE)
FROM [TEST].[dbo].[NDC_CODES]
You can try this:
SELECT TOP 1000 NDC10, CAST(LEFT(AWPUPRICE,4) + '.' + RIGHT(, 5) AS DECIMAL(9,5))
FROM [TEST].[dbo].[NDC_CODES]
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to write a query for count 'noOfDistribution' within a date
and by reference. for example, there are 2 in 1/5/2013.
In addition,can someone recommend some ebook/website to learn advanced skills in
query? Thanks for helping.
Answering your question:
SELECT input_Date, REFERENCE, count(*)
FROM YourTable
GROUP BY input_Date, REFERENCE
But it will result something different you pointed, since for the date 2/5/2013, it will count 6 elements for REFERENCE null
You can do something like thiss....
select count(Input_date) over (partition by Input_date,reference),* from table
By this you can find count of Particular date such as 1/5/2013 has 2 count
alternative way
select date,reference,count(*) from table group by date,reference
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I use ORACLE setup RAC cluster.
My problem is when DB got problem (still dont know the reason ) my sql select lacks rows
example:
select *
from student_detail
where student_id = 1231
should return 10 row data of student have id 1231, but in this case just return 6 rows
can anybody help me to understand this problem!
As a general observation, an Oracle SELECT always returns the correct number of rows. If the result set does not match your expectation then there is a problem with your understanding.
For instance you may have miscounted the number of rows with student_id = 1231. If the query returns only six rows how do you know there are supposed to be ten? It might not be as simple as eyeballing ...
select * from student_detail
order by student_id
... if student_id has a varchar2 datatype and some IDs are suffixed with stray spaces. A query like this will diagnose that problem:
select student_id, count(*)
from student_detail
group by student_id
order by student_id
Other possible causes? A misleading view? Row Level Security restricting the result set? Some bizarre client-side configuration which only shows the first six rows instead of the entire set?
You mention RAC. RAC uses a mechanism called the Global Cache Service Process to transmit changed data to different nodes. It is possible you are experiencing a failure in this process. Talk to your DBA and get them to investigate.
Maybe, the data should be wrong.
for example, if the data of user_id is '1231', that's not wrong, but if the data is left gap
like ' 1231', you can't see the data.
' 1231 ' , '1231 ' also can not be printed out.
The solution is when you insert some data, use the function 'trim' or 'replace'...
trim is only remove left gap.