SQL Help for FMS needed
Hi
Can somebody please tell me what's wrong with this:
declare @result as varchar(30)
if $[$OWTR.Filler] = 'NFE-1'
begin
set @result = (select t1.wareHouse from WOR1 t1 inner join OWOR t2 on t1.DocEntry=t2.DocEntry
where t2.DocNum=$[OWTR.U_SIA_ProdAusg] and t1.VisOrder=$[$23.0.1]-1 AND t1.IssueType='M')
end
else
set @result = 'NFE-1'
select @result
Thanks
Franz
That was not it.
I found it ... sometimes it seems to help to ask for help ...
set @temp = $[$OWTR.Filler]
changed to
set @temp = $[OWTR.Filler]
Thanks anyway
Franz
Similar Messages
-
I do not know if this is the right place for thius type of post. If it is not please advise where the right place is.
I need help generating a report, hopefully with SQL in 8.1.7
SQL Statement which produced the data below the query :
SELECT CHANGE.change_number, CHANGE.route_date as DATE_TO_CCB, nodetable.description AS Approver_required, (TRIM(BOTH ',' FROM CHANGE.PRODUCT_LINES)) AS PRODUCT_LINES /*, PROPERTYTABLE.VALUE as PRODUCT_LINES */
FROM CHANGE, signoff, workflow_process, nodetable /*, PROPERTYTABLE */
WHERE ( (CHANGE.ID = signoff.change_id)
AND (CHANGE.process_id = signoff.process_id)
AND ((nodetable.id = signoff.user_assigned) or (nodetable.id=signoff.user_signed))
AND (CHANGE.process_id = workflow_process.ID)
AND (CHANGE.ID = workflow_process.change_id)
AND (CHANGE.workflow_id = workflow_process.workflow_id)
AND (SIGNOFF.SIGNOFF_STATUS=0 )/* in (0, 2, 3)) */ /* 0=request needs attention, 2=request approved, 3=request rejected */
AND (SIGNOFF.REQUIRED=5 or SIGNOFF.REQUIRED=1) /* 1=Approver 5= Ad Hoc Approver */
AND (CHANGE.IN_REVIEW=1)
AND (CHANGE.RELEASE_DATE IS NULL)
AND (CHANGE.CLASS != '4928')
/* AND (PROPERTYTABLE.PROPERTYID IN (SELECT TRIM(BOTH ',' FROM CHANGE.PRODUCT_LINES) FROM CHANGE)) */
order by change.route_date desc
**** Results **********
CHANGE_NUMBER|DATE_TO_CCB|APPROVER_REQUIRED|PRODUCT_LINES
C02190|11/14/2008 3:34:02 PM|Anurag Upadhyay|270354,270362|
C02190|11/14/2008 3:34:02 PM|Dennis McGuire|270354,270362|
C02190|11/14/2008 3:34:02 PM|Hamid Khazaei|270354,270362|
C02190|11/14/2008 3:34:02 PM|Mandy York|270354,270362|
C02193|11/14/2008 3:05:18 PM|Hamid Khazaei|274279,266339,266340,266341|
C02193|11/14/2008 3:05:18 PM|Rob Brogle|274279,266339,266340,266341|
C02193|11/14/2008 3:05:18 PM|Xavier Otazo|274279,266339,266340,266341|
C02193|11/14/2008 3:05:18 PM|san|274279,266339,266340,266341|
C02194|11/14/2008 2:51:34 PM|Diana Young|271503|
C02194|11/14/2008 2:51:34 PM|Carl Krentz|271503|
C02194|11/14/2008 2:51:34 PM|Dennis Yen|271503|
C02194|11/14/2008 2:51:34 PM|Gordon Ries|271503|
C02194|11/14/2008 2:51:34 PM|Sunil Khatana|271503|
M00532|11/13/2008 1:34:42 PM|Dennis Yen|270356,270354,270360,274279,266339,266340,266341,276780,260784|
M00532|11/13/2008 1:34:42 PM|Jin Hong|270356,270354,270360,274279,266339,266340,266341,276780,260784|
M00532|11/13/2008 1:34:42 PM|Sunil Khatana|270356,270354,270360,274279,266339,266340,266341,276780,260784|
Each value in the numeric comma delimited string has a corresponding ID for the actual test string value in another table as shown below.
PROPERTYID|VALUE
260775|product 1
260776|Product 2
260777|Product x
260778|Product y
260779|Internal
260780|ORCA
260781|Tiger
260782|Orange product
260783|Restricted
260784|Product zz
266259|Product YYY
266260|Hercules
266261|Tangerine
*****Desired output****
CHANGE_NUMBER|DATE_TO_CCB|APPROVER_REQUIRED|PRODUCT_LINES
C02190|Nov/14/2008 03:34:02 PM|Anurag Upadhyay, Dennis McGuire, Hamid Khazaei, Mandy York|Product Y,Product 1
C02193|Nov/14/2008 03:05:18 PM|Hamid Khazaei, Rob Brogle, Xavier Otazo, san|Hercules,Apple,Product 3,Product zz
C02194|Nov/14/2008 02:51:34 PM|Diana Young, Carl Krentz, Dennis Yen, Gordon Ries, Sunil Khatana|Product 2
M00532|Nov/13/2008 01:34:42 PM|Dennis Yen, Jin Hong, Sunil Khatana|Product 1,Product 4,product yy,product YYY,ORCA,Tiger,Orange product,RestrictedHi,
Here's how you can do it in Oracle 8.1.
To get the individual sub-strings from product_lines, join your current result set to this "counter table"
( SELECT ROWNUM AS n
FROM all_objects
WHERE ROWNUM <= 10 -- upper bound on number of items
) cntrIf you don't know the worst case of how many items might be in product_lines, it's a little more complicated:
( SELECT ROWNUM AS n
FROM all_objects
WHERE ROWNUM <= 1 +
SELECT MAX ( LENGTH (product_lines)
- LENGTH (REPLACE (product_lines, ','))
FROM table_name
) cntrJoin this to the existing result set like this
WHERE ...
AND INSTR ( product_lines || ',' -- one extra comma added
, 1
, n
) > 0When you do the join, you will have
one copy of all the rows with one item in producgt_lines,
two copies of all the rows with two items in producgt_lines,
three copies of all the rows with three items in producgt_lines,
and so on.
When a row has been copied, each copy will have a different value of cntr.n.
To extract the n-th substring from product_lines:
SELECT ...
SUBSTR ( product_lines
, INSTR ( ',' || product_lines, ',', 1, n)
, ( INSTR (product_lines || ',', ',', 1, n)
- INSTR (',' || product_lines, ',', 1, n)
) AS product_lines_itemWhen you have derived this column, you can join to the table with the translations
WHERE TO_NUMBER (product_lines_item) = propertyidTo combine these rows into one row with a comma-delimited list, GROUP BY all the columns you want to select except the property_value ('produc 1', 'tangerine', etv.), and SELECT:
LTRIM ( MAX (CASE WHEN n = 1 THEN ',' || property_value END) ||
MAX (CASE WHEN n = 2 THEN ',' || property_value END) ||
MAX (CASE WHEN n = 10 THEN ',' || property_value END)
)I don't know a good way to re-combine the rows in Oracle 8 without assuming some limit on the number of items. I assumed there would never be more than 10 in the example above. You can say 20 or 100, I suppose, if you want to. If you guess too high, everything will still work: the query will just be slower.
This is a just one example of why packing several values into a single column is a bad idea. -
SQL Help for Date Range display
Gurus,
I have a sql statement like
select MIN(HIREDATE), MAX(HIREDATE) FROM EMP WHERE DEPTNO = 30My output looks like
MIN(HIREDATE) MAX(HIREDATE)
12/30/1998 12/30/2001Based on the values of MIN(HIREDATE) , MAX(HIREDATE) values
I need a SQL to generate the output like
12/30/1998
1/30/1999
2/28/1999
until Max(HIREDATE) value
In Feb we dont have 30th day, In that case take the last day of the month.
Thanks for great help
C 007With 10g.
Regards Salim.WITH t AS
(SELECT min(hiredate) min_hiredate,
max(hiredate) max_hiredate
FROM emp_test
where deptno=30)
SELECT min_hiredate dt
FROM t
model
dimension by ( 1 rn)
measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
(min_hiredate[for rn from 1 to diff[1] increment 1]=add_months( min_hiredate[1],cv(rn)-1))
order by rn
SQL> WITH t AS
2 (SELECT min(hiredate) min_hiredate,
3 max(hiredate) max_hiredate
4 FROM emp_test
5 where deptno=30)
6 SELECT min_hiredate dt
7 FROM t
8 model
9 dimension by ( 1 rn)
10 measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
11 (min_hiredate[for rn from 1 to diff[1] increment 1]=add_months( min_hiredate[1],cv(rn)-1))
12 order by rn
13 /
DT
1998-12-30
1999-01-30
1999-02-28
1999-03-30
1999-04-30
1999-05-30
1999-06-30
1999-07-30
1999-08-30
1999-09-30
1999-10-30
1999-11-30
1999-12-30
2000-01-30
2000-02-29
2000-03-30
2000-04-30
2000-05-30
2000-06-30
2000-07-30
2000-08-30
2000-09-30
2000-10-30
2000-11-30
2000-12-30
2001-01-30
2001-02-28
2001-03-30
2001-04-30
2001-05-30
2001-06-30
2001-07-30
2001-08-30
2001-09-30
2001-10-30
2001-11-30
SQL> -
Hi all,
Can we seek for help in SQL?
I have an system analysis which calculate the concurrent usage of a computer system.
I have add all data which is stored in .CSV file and then insert into a table named as Activity.
Can we select the data from activity and generate an Excel file which report the calculation on the concurrent usage of a computer system?fionanycheng wrote:
Hi all,
Can we seek for help in SQL?
I have an system analysis which calculate the concurrent usage of a computer system.
I have add all data which is stored in .CSV file and then insert into a table named as Activity.
Can we select the data from activity and generate an Excel file which report the calculation on the concurrent usage of a computer system?
So, you have data in a .csv file
Then you load that data into a relational database.
Now you want to select that data and place it back into a file for Excel ......
Hmm.. Makes me wonder why you bothered with the database in the middle.
the database itself is more than capable of efficiently performing your calculations (assuming a reasonably rational table design).
Maybe you could provide a better description of the business problem to be solved, instead of a pre-conceived (and possibly ill-conceived) technical solution to that unspecified business problem. The we could provide better advice. -
I am a beginner in using labview. I need to use labview signal to turn on >=2 ac 8 actuators with one power supply. The 24VDC, 0-3A power supply is enough to drive all 8 actuators which need 24VDC and 0.1A current. So the main function is like turning on 2 or more than 2 switches in series with the 8 actuators with one power supply. Any suggestion of some simple module for this purpose? Thanks.
Maybe I didn't say the question clear. I have one power supply (24VDC, 0-3A) and 8 solenoid valves (24VDC and 0.1A). Two valves (or more than two in future) have to be activated each time. I would like to find something that can work like switches installed in series with the valves. Then I can wire the valves (with the switches) in parallel with the power supply. As I turn the switches on and off with signals from Labview board, power to that specific valve will be turned on and off.
Any advice for this kind of switches or any module that can be controlled by Labview signal? Please help! Thanks. -
CRM Middleware help for rookie needed.. Replication of Business Transaction
Hi guys,
I try to set up replication of Business Transactions from R/3 to CRM and vice versa.
I have created:
- CRM site type (CRM) , R/3 type site (R46CLNT700)
then I created a subscription: SalesDocuments (R46CLNT700 is assigned to this subscription) for publication "All Business Transactions (MESG)".
a, Is this enough configuration of MW for needed replication? Or do I need more settings set up?
b, When I try to start initial load of the Replication object BUS_TRANS_MSG (which is "in" publication All Business Transactions), I am not able to start Load from CRM to R46CLNT700).. As target I can use only CDB... What is wrong?
c, If I create some sales transaction in CRM system and I want it to be replicated to R/3 and vice versa, how will I know, which replication object represents this document? For example, I create a Sales Order. How will I know, which replication object to set up for replication?
Thanx a lot! PeterPeter,
1.If you are looking for Initial download from CRM to R/3, this should be possible from CRM v4.0.
2. Delta flow between the systems should happen once your initial download is complete.
3. Check the Inbound and Outbound queues in CRM. If they seems to be hanging for long time, check whether you have registered the Inbound & Oubtound queues in SMQR and SMQS transaction on both CRM and R/3.
Regards,
Phani.
Wipro Technologies -
Hi
I am trying to create a Stock Market Technical Indicator named - Commodity Channel Index (CCI)
Date High_Price Low_Price Close_Price True_Price TPMA MD
02-Jan-07 2297 2238 2273 2269
03-Jan-07 2320 2273 2311 2301
04-Jan-07 2325 2275 2285 2295
05-Jan-07 2305 2256 2275 2279
08-Jan-07 2280 2193 2206 2226 2274 21
09-Jan-07 2235 2173 2190 2200 2260 38
10-Jan-07 2200 2153 2164 2173 2234 42
11-Jan-07 2215 2095 2183 2164 2208 35
12-Jan-07 2232 2200 2223 2218 2196 22
15-Jan-07 2248 2230 2243 2240 2199 24
16-Jan-07 2250 2216 2222 2229 2205 29
17-Jan-07 2245 2197 2205 2216 2214 20
Where Date, HighPrice,LowPrice,CLosePrice is the input from a table
Below is the computation of other columns
True_Price = (HighPrice+LowPrice+Closeprice)/3
TPMA = 5 Days Average True_Price (last 5 values of True_Price includeing the current) [Note:First 4 values will be 0/Null ]
MD = ABS(TPMA[5]-True_Price[5]) + ABS(TPMA[5]-True_Price[4]) + ABS(TPMA[5]-True_Price[3])+ ABS(TPMA[5]-True_Price[2])+ ABS(TPMA[5]-True_Price[1]) [Note:First 4 values will be 0/Null ]
Please note this 5 days average is a parameter so it can be 5 days , 10 day, 20 day etc so the calculation will based on this parameter+
For Example if parameter is 10 days then
TPMA = 10 Days Average of True_Price(last 10 values of True_Price includeing the current) [Note:First 9 values will be 0/Null ]
MD = ABS(TPMA[10]-True_Price[10]) ABS(TPMA[10]-True_Price[9]) ABS(TPMA[10]-True_Price[8]) ABS(TPMA[10]-True_Price[7]) ABS(TPMA[10]-True_Price[6]) ABS(TPMA[10]-True_Price[5]) ABS(TPMA[10]-True_Price[4]) + ABS(TPMA[10]-True_Price[3])+ ABS(TPMA[10]-True_Price[2])+ ABS(TPMA[10]-True_Price[1]) [Note:First 9 values will be 0/Null ]
I am really struck with computation of column MD and not sure how to make it generic to work for any value
Thanks in advance for your help
Regards
RakeshHi
I am trying to create a Stock Market Technical Indicator named - Commodity Channel Index (CCI)
Date High_Price Low_Price Close_Price True_Price TPMA MD
02-Jan-07 2297 2238 2273 2269
03-Jan-07 2320 2273 2311 2301
04-Jan-07 2325 2275 2285 2295
05-Jan-07 2305 2256 2275 2279
08-Jan-07 2280 2193 2206 2226 2274 21
09-Jan-07 2235 2173 2190 2200 2260 38
10-Jan-07 2200 2153 2164 2173 2234 42
11-Jan-07 2215 2095 2183 2164 2208 35
12-Jan-07 2232 2200 2223 2218 2196 22
15-Jan-07 2248 2230 2243 2240 2199 24
16-Jan-07 2250 2216 2222 2229 2205 29
17-Jan-07 2245 2197 2205 2216 2214 20
Where Date, HighPrice,LowPrice,CLosePrice is the input from a table
Below is the computation of other columns
True_Price = (HighPrice+LowPrice+Closeprice)/3
TPMA = 5 Days Average True_Price (last 5 values of True_Price includeing the current) [Note:First 4 values will be 0/Null ]
MD = ABS(TPMA[5]-True_Price[5]) + ABS(TPMA[5]-True_Price[4]) + ABS(TPMA[5]-True_Price[3])+ ABS(TPMA[5]-True_Price[2])+ ABS(TPMA[5]-True_Price[1]) [Note:First 4 values will be 0/Null ]
Please note this 5 days average is a parameter so it can be 5 days , 10 day, 20 day etc so the calculation will based on this parameter+
For Example if parameter is 10 days then
TPMA = 10 Days Average of True_Price(last 10 values of True_Price includeing the current) [Note:First 9 values will be 0/Null ]
MD = ABS(TPMA[10]-True_Price[10]) ABS(TPMA[10]-True_Price[9]) ABS(TPMA[10]-True_Price[8]) ABS(TPMA[10]-True_Price[7]) ABS(TPMA[10]-True_Price[6]) ABS(TPMA[10]-True_Price[5]) ABS(TPMA[10]-True_Price[4]) + ABS(TPMA[10]-True_Price[3])+ ABS(TPMA[10]-True_Price[2])+ ABS(TPMA[10]-True_Price[1]) [Note:First 9 values will be 0/Null ]
I am really struck with computation of column MD and not sure how to make it generic to work for any value
Thanks in advance for your help
Regards
Rakesh -
Some SQL Help for a Complete Beginner
...........
Use ROLLUP then
SQL> select id,
2 case when grouping(id)=1 and grouping(pro_name)=1 then 'Total' else pro_name end pro_name
3 sum(quantity) quantity
4 from product
5 group by rollup(id, pro_name)
6 having (grouping(id)=0 and grouping(pro_name)=0)
7 or (grouping(id)=1 and grouping(pro_name)=1)
8 /
ID PRO_NAME QUANTITY
11011 Socket Type 3 20
11110 Wrench Type 2 44
11111 Bolt Type 1 40
22022 Hammer 30
22220 Wrench Type 3 44
22222 Bolt Type 2 40
33330 Wrench Type 4 44
33333 Bolt Type 3 40
44440 Nut Type 1 80
44444 Bolt Type 4 40
55550 Nut Type 2 80
55555 Nail Type 1 400
66660 Nut Type 3 80
66666 Nail Type 2 400
77770 Nut Type 4 80
77777 Nail Type 3 400
88880 Socket Type 1 20
88888 Nail Type 4 400
99990 Socket Type 2 20
99999 Wrench Type 1 44
Total 2346
21 rows selected.Your price field is CHAR data type. You cant use it with quantity field which is a NUMBER data type.
The basic structure of your table is wrong you need to modify it.
Edited by: Karthick_Arp on May 8, 2009 11:47 PM -
Hi all,
Here is my requirement for reporting purpose…….
Can you please help me? See below example.
with t as (select 1 id, 'missing' col1,'expired' col2,'duplicate' col3,'other' col4 from dual union all
select 2 id, 'missing' col1,'expired' col2,'duplicate' col3,'other' col4 from dual
select * from t
id col1 col2 col3 col4
1 missing expired duplicate other
2 missing expired duplicate other
Required out is
id new_col
1 missing
1 expired
1 duplicate
1 other
2 missing
2 expired
2 duplicate
2 other
Thanks in advance,Isn't fun to play around and see what happens?
WITH t AS
(SELECT 1 id,
'missing' col1,
'expired' col2,
'duplicate' col3,
'other' col4
FROM dual
UNION ALL
SELECT 2 id,
'missing' col1,
'expired' col2,
'duplicate' col3,
'other' col4
FROM dual
SELECT id,
new_col
FROM t unpivot include nulls (new_col FOR col IN (col1, col2, col3, col4));gives
ID NEW_COL
1 missing
1 expired
1 duplicate
1 other
2 missing
2 expired
2 duplicate
2 other
8 rows selectedNow this only works in 11g, so it's a great reason to get there.
-Andy -
Nobody Help for customer service .... !!
我買了iPAD 2 但耳機被卡在內斷了,唔幫我整,又話要收錢....被蘋果欺騙了!!
I've bought an "iPad 2" in a month & my ear phone plug just crashed in the jack socket ... NO one can help for fix & need for payment .....
<Edited by Host>But They say that is are human's user problem , it's not under warranty ..... & if i need to fix that problem , I need to PAY $2400- for change a new one ..... haha , My ipad 2 just bought one mouth & only $3888- ....
That's is are joking ..... ?? -
Need help on SQL Statement for UDF
Hi,
as I am not so familiar with SQL statements on currently selected values, I urgently need help.
The scenario looks as follows:
I have defined two UDFs named Subgroup1 and Subgroup2 which represent the subgroups dependent on my article groups. So for example: When the user selects article group "pianos", he only sees the specific subgroups like "new pianos" and "used pianos" in field "Subgroup1". After he has selected one of these specific values, he sees only the specific sub-subgroups in field "Subgroup2", like "used grand pianos".
I have defined UDTs for both UDFs. The UDT for field "Subgroup1" has a UDF called "ArticleGroup" which represents the relation to the article group codes. The UDT for field "Subgroup2" has a UDF called "Subgroup1" which represents the relation to the subgroups one level higher.
The SQL statement for the formatted search in field "Subgroup1" looks as follows:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP1] T0 WHERE T0.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod])
It works fine.
However, I cannot find the right statement for the formatted search in field "Subgroup2".
Unfortunately this does NOT WORK:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT $[OITM.U_Subgroup1])
I tried a lot of others that didn't work either.
Then I tried the following one:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT T1.[Code] FROM [dbo].[@B_SUBGROUP1] T1 WHERE T1.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod]))
Unfortunately that only works as long as there is only one specific subgroup1 for the selected article group.
I would be sooooo happy if there is anyone who can tell me the correct statement for my second UDF!
Thanks so much in advance!!!!
Edited by: Corinna Hochheim on Jan 18, 2010 10:16 PM
Please ignore the "http://" in the above statements - it is certainly not part of my SQL.
Please also ignore the strikes.Hello Dear,
Use the below queries to get the values:
Item Sub Group on the basis of Item Group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[U_GroupCod] =$[OITM.ItmsGrpCod]
Item Sub Group 1 on the basis of item sub group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[U_SubGrpCod]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp])
Sub group 2 on the basis of sub group 1
SELECT T0.[Name] FROM [dbo].[@SUBGROUP2] T0 WHERE T0.[U_SubGrpCod1]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp1])
this will help you.
regards,
Neetu -
Need help for the sql statement !!!!!
hi all,
i need a sql statement for a query, how can i get the result from the rownum between 100 and 150?
plz helpuse a scrollable statement:
PreparedStatement stat = Connection.prepareStement("select * from blah", ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stat.executeQuery();
rs.absolute(100);
while (rs.next()) {
String something = rs.get(1);
Look into the JDK API reference for ResultSet to get an expalantion of scrollable statements. -
Trying to buy single instance support for FMS from Adobe. Need help.
Hey all,
I've spent all day on the phone with Adobe trying to purchase single incident support for some server side developement questions on Flash Media Interactive Server 3.0.
So far I have not been able to find anyone at Adobe that knows how to do this. The web site says it is possible and they even give a number to call but I've talked to at least three people at that number and no one could help me. I've also talked to people in Sales, Volume license sales,and at least three different areas in technical support and no one seems to know how to get it done. Has anyone ever successfully purchased single incident support for FMS 3 and if so is there some specific number I could call to talk to someone who can make it happen.
-JohnI am answering my own question. After spending an entire afternoon on the phone being bounced around between Adobe technical support and Adobe sales, I've come to the determination that you cannot buy single incident support for Flash Media Server. At least I was never able to talk to someone at Adobe that knew if it was possible. The number on the web site where it specifically says to call for purchase of single incident support for FMS is not the correct number.
-John -
Need help on Sql command for count
Hi,
I have the following table.
Temp_Set Table
ID Names Action
1 John Delete
2 John Add
3 Mary Update
4 Sim Add
5 Sim Update
How do I do a SELECT sql command for count(names) > 1 ?
Please kindly advise me. Thank you very much.It doesnt work when I do this
SELECT * FROM Temp_Set
HAVING Count(names) > 1
It prompts me the following error:
ORA-00937: not a single-group group function
00937.00000 - "not a single-group group function"
*Cause:
*Action:
Error at Line:16 Column:7i am not sure but you can try this:
SELECT B.* FROM
(SELECT NAMES, COUNT(1) CNT FROM TEMP_SET GROUP BY NAMES) A, TEMP_SET B
WHERE A.NAMES = B.NAME
AND CNT > 1 -
Need help for understanding the behaviour of these 2 queries....
Hi,
I need your help for understanding the behaviour of following two queries.
The requirement is to repeat the values of the column in a table random no of times.
Eg. A table xyz is like -
create table xyz as
select 'A' || rownum my_col
from all_objects
where rownum < 6;
my_col
A1
A2
A3
A4
A5
I want to repeat each of these values (A1, A2,...A5) multiple times - randomly decide. I have written the following query..
with x as (select my_col, trunc(dbms_random.value(1,6)) repeat from xyz),
y as (select level lvl from dual connect by level < 6)
select my_col, lvl
from x, y
where lvl <= repeat
order by my_col, lvl
It gives output like
my_col lvl
A1 1
A1 3
A1 5
A2 1
A2 3
A2 5
A3 1
A3 3
A3 5
A4 1
A4 3
A4 5
A5 1
A5 3
A5 5
Here in the output, I am not getting rows like
A1 2
A1 4
A2 2
A2 4
Also, it has generated the same set of records for all the values (A1, A2,...,A5).
Now, if I store the randomly-decided value in the table like ---
create table xyz as
select 'A' || rownum my_col, trunc(dbms_random.value(1,6)) repeat
from all_objects
where rownum < 6;
my_col repeat
A1 4
A2 1
A3 5
A4 2
A5 2
And then run the query,
with x as (select my_col, repeat from xyz),
y as (select level lvl from dual connect by level < 6)
select my_col, lvl
from x, y
where lvl <= repeat
order by my_col, lvl
I will get the output, exactly what I want ---
my_col ....lvl
A1 1
A1 2
A1 3
A1 4
A2 1
A3 1
A3 2
A3 3
A3 4
A3 5
A4 1
A4 2
A5 1
A5 2
Why the first approach do not generate such output?
How can I get such a result without storing the repeat values?If I've understood your requirement, the below will achieve it:
SQL> create table test(test varchar2(10));
Table created.
SQL> insert into test values('&test');
Enter value for test: bob
old 1: insert into test values('&test')
new 1: insert into test values('bob')
1 row created.
SQL> insert into test values('&test');
Enter value for test: terry
old 1: insert into test values('&test')
new 1: insert into test values('terry')
1 row created.
SQL> insert into test values('&test');
Enter value for test: steve
old 1: insert into test values('&test')
new 1: insert into test values('steve')
1 row created.
SQL> insert into test values('&test');
Enter value for test: roger
old 1: insert into test values('&test')
new 1: insert into test values('roger')
1 row created.
SQL> commit;
Commit complete.
SQL> select lpad(test,(ceil(dbms_random.value*10))*length(test),test) from test;
LPAD(TEST,(CEIL(DBMS_RANDOM.VALUE*10))*LENGTH(TEST),TEST)
bobbobbobbobbobbobbobbobbobbob
terryterry
stevestevesteve
rogerrogerrogerrogerrogerrogerrogerrogerrogerYou can alter the value of 10 in the SQL if you want the potential for a higher number of names.
Andy
Maybe you are looking for
-
Good evening, Can you help me, my trouble is: I have a WDA with my screen elements. Some of tjhs elements have standart search help. When i run my application, i am login to the system, but when i press F4 on the field, login window to the system run
-
Safari is extremely slow to load pages & saving my bookmarks to my folders
why is safari so extremely slow in loading pages? it can just about load my e-mail, if I wait about 5 minutes & I cannot check my t mobile cell phone balance because it gets stuck loading the page. Also I cannot get it to save bookmarks into my desig
-
Friend with 3G iPad no FaceTime icon in my Contacts?
Unlike other Apple contacts/friends and family, Deb (who has a 3G new iPad) has no FaceTime icon in the contact info for her on my WiFi iPad 2 but does have that icon in my iPhone 4 contact info. Why?
-
Connecting to my computer remotely?
Hey there. I am trying to make it to where I can connect to my computer remotely using FTP file sharing. In Sharing preferences, I have FTP access turned on and have set my local hostname to The Chariot. When I select File Sharing, it tells me that o
-
I can't add any more columns. The option is suddenly greyed out.
I can't add any more columns. The option is suddenly greyed out.