-
Feb 13th, 2018, 02:11 PM
#1
Thread Starter
Junior Member
problem with sql query
Hi
I have a problem with datagrid1.
Downloading data through Adodc1 but I can not add another column in which if in column1 I have 01 in the added column gives me 100 if 02 is 200, 03 is 500, 04 is 70
The query from the database I have such
Code:
select SUBSTR (number, 1,2),
SUM (ILOSC) FROM my data WHERE status = '200' AND city = 'Wroclaw'
GROUP BY SUBSTR (number, 1,2), ILOSC ORDER BY SUBSTR ( number, 1,2) ASC
-
Feb 13th, 2018, 04:16 PM
#2
Re: problem with sql query
Database you use? SQL Server, Oracle, Access, ...
-
Feb 13th, 2018, 04:21 PM
#3
Thread Starter
Junior Member
Re: problem with sql query
-
Feb 13th, 2018, 04:29 PM
#4
Re: problem with sql query
-
Feb 13th, 2018, 04:34 PM
#5
Thread Starter
Junior Member
Re: problem with sql query
I tried and I can not grasp
-
Feb 13th, 2018, 04:38 PM
#6
Member
Re: problem with sql query
-
Feb 13th, 2018, 04:44 PM
#7
Re: problem with sql query
Originally Posted by ewcia87
I tried and I can not grasp
How did you try?
Do you think we can guess it by ourselves?
-
Feb 13th, 2018, 04:58 PM
#8
Thread Starter
Junior Member
Re: problem with sql query
Code:
select SUBSTR (liczba, 1,2),SUMA (ILOSC),CASE SUBSTR(liczba,1,2) WHEN 01 THEN '100'WHEN 02 THEN '200'
ELSE 'brak' END FROM my_data WHERE status = '200' AND city = 'Wroclaw'
GROUP BY SUBSTR (liczba, 1,2), ILOSC ORDER BY SUBSTR (liczba, 1,2) ASC
receives a message
ORA-00932 Error message
Last edited by ewcia87; Feb 13th, 2018 at 05:08 PM.
-
Feb 13th, 2018, 05:31 PM
#9
Re: problem with sql query
You error because you try to compare different data type:
https://www.techonthenet.com/oracle/errors/ora00932.php
SUBSTR return a string data type, while 01 is NOT a string.
Try to use '01' instead, and so on...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|