Turn query into a GROUP BY
I'm trying to turn the query below so it only produces the first line for each user,each responsibility combination:
select a.LOGIN_ID,a.START_TIME,a.END_TIME,c.RESPONSIBILITY_NAME,b.USER_ID,d.USER_NAME from FND_LOGIN_RESPONSIBILITIES a,
fnd_logins b,
FND_RESPONSIBILITY_tl c,
fnd_user d
where
a.LOGIN_ID=b.LOGIN_ID
and a.RESPONSIBILITY_ID=c.RESPONSIBILITY_ID
and b.USER_ID=d.USER_ID
order by d.user_name, c.responsibility_name, a.end_TIME desc nulls lastThat's for a unique combination of user and responsibility, it should return only the first value. Currently it's returning multiple outputs int the format:
LOGIN_ID START_TIM END_TIME RESPONSIBILITY_NAME USER_ID USER_NAME
1487207 23-NOV-11 23-NOV-11 XXX Payables Supervisor 1236 ZZZ
1487207 23-NOV-11 23-NOV-11 XXX Payables Supervisor 1236 ZZZ
1480785 22-NOV-11 22-NOV-11 XXX Payables Supervisor 1236 ZZZ
1478246 22-NOV-11 22-NOV-11 XXX Payables Supervisor 1236 ZZZ
1478246 22-NOV-11 22-NOV-11 XXX Payables Supervisor 1236 ZZZ
3149187 14-DEC-12 14-DEC-12 XXX Imprest Employee Responsibility 5825
3136830 11-DEC-12 11-DEC-12 XXX Imprest Employee Responsibility 5825 ZZZ
3102226 03-DEC-12 03-DEC-12 XXX Imprest Employee Responsibility 5825 ZZZ
3094387 30-NOV-12 30-NOV-12 XXX Imprest Employee Responsibility 5825 ZZZ
3094387 30-NOV-12 30-NOV-12 XXX Imprest Employee Responsibility 5825 ZZZ
3093463 29-NOV-12 29-NOV-12 XXX Imprest Employee Responsibility 5825 ZZZ
3090327 29-NOV-12 29-NOV-12 XXX Imprest Employee Responsibility 5825 ZZZThis should only output as below:
LOGIN_ID START_TIM END_TIME RESPONSIBILITY_NAME USER_ID USER_NAME
1487207 23-NOV-11 23-NOV-11 XXX Payables Supervisor 1236 ZZZ
3149187 14-DEC-12 14-DEC-12 XXX Imprest Employee Responsibility 5825 ZZZMy database version is 11.2.0.2.0
James
Try to understand and guess your entity relationship with limited info in hand, you may try below SQL
Select a1.login_id
a1.START_TIME,
a1.END_TIME,
c.RESPONSIBILITY_NAME,
b.USER_ID,
d.USER_NAME
(select a.LOGIN_ID,
a.RESPONSIBILITY_ID
b.user_id,
from FND_LOGIN_RESPONSIBILITIES a,
fnd_logins b,
where a.LOGIN_ID=b.LOGIN_ID
group by a.login_id, b.user_id) t
FND_LOGIN_RESPONSIBILITIES a1,
FND_RESPONSIBILITY_tl c,
fnd_user d
where a1.lonin_id = t.login_id
and a1.RESPONSIBILITY_ID=c.RESPONSIBILITY_ID
and t.USER_ID= d.USER_IDHowever not sure you data attributes and content, cannot run in my database.
Edited by: user503635 on Jan 10, 2013 9:21 PM
Similar Messages
-
How do I get this query into Discoverer Plus
Hi all,
I have the following query:
SELECT h.hrs, NVL(Quantity, 0) Quantity
FROM (SELECT TRIM(to_char(LEVEL - 1, '00')) hrs
FROM dual
CONNECT BY LEVEL < 25) h
LEFT JOIN (SELECT TO_CHAR(event_date, 'HH24') AS during_hour,
COUNT(*) Quantity
FROM user_activity u
WHERE event_date BETWEEN
to_date('15-JUN-2010 14:00:00', 'DD-MON-YYYY HH24:MI:SS') AND
to_date('16-JUN-2010 13:59:59', 'DD-MON-YYYY HH24:MI:SS')
AND event = 'user.login'
GROUP BY TO_CHAR(event_date, 'HH24')) t
ON (h.hrs = t.during_hour)
ORDER BY h.hrs;
Which produces the number of actions performed (from an event table, user_activity) grouped by the hour of the day they occurred (including displaying hours that have zero records - this bit is important!). I want to be able to put this into Discoverer plus as a worksheet, but I'm having trouble trying to figure out how.
I was able to create a custom folder in Administrator for the select from DUAL, but I cannot link it to the user_activity table because there's no relationship between to two tables to create a join.
The user_activity table is:
USER_ID - VARCHAR2(8 CHAR)
EVENT_DATE - DATE
EVENT - VARCHAR2(100 CHAR)
The custom folder is this part of the SQL:
SELECT TRIM(to_char(LEVEL - 1, '00')) hrs FROM dual CONNECT BY LEVEL < 25
Any suggestions would be greatly appreciated.
Thanks.
Edited by: Cyntech on Aug 12, 2010 10:41 AMKK wrote:
hi,
In the custom folder we can join tables,but the thing is you said ther is no join between them.
I would suggest you to built this query into a view and use this view in the DUAL table by writing inline query or subquery what ever way.
This is the only possibility i can think off.
Hope it helps you.
By,
KKHi,
Thanks for the reply, though I'm not sure that I understand what you are suggesting.
Which query would you turn into a view? If you are referring to the select from dual, then how would the view be any different from the custom folder? You still would not be able to join it to user_activity as there are no common columns.
Edited by: Cyntech on Aug 12, 2010 2:49 PM -
SNMP query for multicast group count
I want to get the total number of multicast groups on a switch. Is there an oid that will give me the info (ie. the number that's given by "show ip igmp snooping groups count")? If there is no oid, is there a way query the groups (show ip igmp snooping groups)? I'm thinking with the 2nd option I might be able to count the number of entries returned by an snmpwalk or something and turn that into a number.
Right now i'm logging into the switch with a script and running the command but that might be a problem with all those logins (only every 5 minutes though) so I'd like to do this via SNMP if possible.
Any ideas?
ThanksWorks just fine!!!
Thanks!
LA$$E
Hi,
Well, at the very least, you can create a formula
column in your break group using a combination of the
same where clause as your original query and the
break values for the group so that you are getting
the correct records. If you have it in the break
group, then it will execute for each record in that
group.
Hope that helps,
Toby -
HOW TO TURN $6 INTO $6,000!!!!!! READING THIS COULD CHANGE
YOUR LIFE!
I found this on a bulletin board and decided to try it. A
little while back,
I was browsing through newsgroups, just like you are now, and
came across an
article similar to this that said you could make thousands of
dollars within
weeks with only an initial investment of $6.00! So I thought,
Yeah right,
this must be a scam,but like most of us, I was curious, so I
kept reading.
Anyway, it said that you send $1.00 to each of the 6 names
and address
stated in the article. You then place your own name and
address in the
bottom of the list at #6, and post the article in at least
200 newsgroups.
(There are thousands) No catch, that was it. So after
thinking it over, and
talking to a few people first, I thought about trying it. I
figured: what
have I got to lose except 6
stamps and $6.00, right? Then I invested the measly $6.00.
Well GUESS
WHAT!!...
within 7 days, I started getting money in the mail! I was
shocked! I figured
it would end soon, but the money just kept coming in. In my
first week, I
made about $25.00. By the end of the second week I had made a
total of over
$1,000.00! In the third week I had over $10,000.00 and it's
still growing.
This is now my fourth week and I have made a total of just
over $42,000.00
and it's still coming in rapidly. It's certainly worth $6.00,
and 6 stamps,
I have spent more than that on the lottery!! Let me tell you
how this works
and most importantly, why it works....Also, make sure you
print a copy of
this article NOW, so you can get the information off of it as
you need it. I
promise you
that if you follow the directions exactly, that you will
start making more
money than you thought possible by doing something so easy!
Suggestion: Read this entire message carefully! (Print it out
or download
it.) Follow the simple directions and watch the money come
in! It's easy.
It's legal. And, your investment is only $6.00 (Plus postage)
IMPORTANT: This is not a rip-off; it is not indecent; it is
not illegal; and
it is virtually no risk - it really works!!!! If all of the
following
instructions are adhered to, you will receive extraordinary
dividends.
PLEASE NOTE: Please follow these directions EXACTLY, and
$50,000 or more can
be yours in 20 to 60 days. This program remains successful
because of the
honesty and integrity of the participants. Please continue
its success by
carefully
adhering to the instructions. You will now become part of the
Mail Order
business. In this business your product is not solid and
tangible, it's a
service. You are in the business of developing Mailing Lists.
Many large
corporations are happy to pay big bucks for quality lists.
However, the
money made from the mailing lists is secondary to the income
which is made
from people like you and me asking to be included in that
list. Here are the
4 easy steps to success:
STEP 1: Get 6 separate pieces of paper and write the
following on each piece
of paper; PLEASE PUT ME ON YOUR MAILING LIST. Now get 6 US
$1.00 bills and
place ONE inside EACH of the 6 pieces of paper so the bill
will not be seen
through the envelope (to prevent thievery). Next, place one
paper in each of
the 6 envelopes and seal them. You should now have 6 sealed
envelopes, each
with a piece of paper stating the above phrase, your name and
address, and a
$1.00 bill. What you are doing is creating a service. THIS IS
ABSOLUTELY
LEGAL! You are requesting a legitimate service and you are
paying for it!
Like most of us I was a little skeptical and a little worried
about the
legal aspects of it all. So I checked it out with the U.S.
Post Office
(1-800-725-2161) and they
confirmed that it is indeed legal! Mail the 6 envelopes to
the following
addresses:
Mailing Adresses
Stephanie Hicks
1283 Evening Canyon
Henderson NV 89014
Ross Wilson
202 Belmont Dr.
Thibodaux, LA 70301
James Small
4690 Sierra St.
Riverside, CA 92504
Thomas G.
P.O. Box 591939
Houston, TX 77259
S. Parker
159 Main Street
Dadeville, Alabama 36853
A. Wyman
9734 Landowne ct.
Orlando, FL 32817
STEP 2: Now take the #1 name off the list that you see above,
move the other
names up (6 becomes 5, 5 becomes 4, etc...) and add YOUR Name
as number 6 on
the list.
STEP 3: Change anything you need to, but try to keep this
article as close
to
original as possible. Now, post your amended article to at
least 200
newsgroups. (I think there are close to 24,000 groups) All
you need is 200,
but remember, the more you post, the more money you make!
This is perfectly
legal! If you have any doubts, refer to Title 18 Sec. 1302
& 1341 of the
Postal lottery laws. Keep a copy of these steps for yourself
and, whenever
you need money, you can use it again, and again.
PLEASE REMEMBER that this program remains successful because
of the honesty
and integrity of the participants and by their carefully
adhering to the
directions. Look at it this way. If you are of integrity, the
program will
continue and the money that so many others have received will
come your way.
NOTE: You may want to retain every name and address sent to
you, either on a
computer or hard copy and keep the notes people send you.
This VERIFIES that
you are truly providing a service. (Also, it might be a good
idea to wrap
the $1 bill in dark paper to reduce the risk of mail theft.)
So, as each
post is downloaded and the directions carefully followed, six
members will
be reimbursed for their participation as a List Developer
with one dollar
each. Your name will move up the list geometrically so that
when your name
reaches the #1 position you will be receiving thousands of
dollars in
CASH!!! What an opportunity for only $6.00 ($1.00 for each of
the first six
people listed above) Send it now, add your own name to the
list and you're
in business!
---DIRECTIONS ----- FOR HOW TO POST TO NEWSGROUPS------------
Step 1) You do
not need to re-type this entire letter to do your own
posting. Simply put
your cursor at the beginning of this letter and drag your
cursor to the
bottom of this document, and select 'copy' from the edit
menu. This will
copy the entire letter into the computer's memory.
Step 2) Open a blank 'notepad' file and place your cursor at
the top of the
blank page. From the 'edit' menu select 'paste'. This will
paste a copy of
the letter into notepad so that you can add your name to the
list.
Step 3) Save your new notepad file as a .txt file. If you
want to do your
postings in different settings, you'll always have this file
to go back to.
Step 4) Use Netscape or Internet explorer and try searching
for various
newsgroups (on-line forums, message boards, chat sites,
discussions.) Step
5) Visit these message boards and post this article as a new
message by
highlighting the text of this letter and selecting paste from
the edit menu.
Fill in the Subject, this will be the header that everyone
sees as they
scroll through the list of postings in a particular group,
click the post
message button. You're done with your first one!
Congratulations...THAT'S
IT! All you have to do is jump to different newsgroups and
post away, after
you get the hang of it, it will take about 30 seconds for
each newsgroup!
**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY
YOU WILL MAKE!!
BUT YOU HAVE TO POST A MINIMUM OF 200**
That's it! You will begin receiving money from around the
world within days!
You may eventually want to rent a P.O.Box due to the large
amount of mail
you will receive. If you wish to stay anonymous, you can
invent a name to
use, as long as the postman will deliver it.
**JUST MAKE SURE ALL THE ADDRESSES ARE CORRECT.** Now the WHY
part: Out of
200 postings, say I receive only 5 replies (a very low
example). So then I
made $5.00 with my name at #6 on the letter. Now, each of
the 5 persons who just sent me $1.00 make the MINIMUM 200
postings, each
with my name at #5 and only 5 persons respond to each of the
original 5,
that is another $25.00 for me, now those 25 each make 200
MINIMUM posts with
my name at #4 and only 5 replies each, I will bring in an
additional
$125.00! Now, those 125 persons turn around and post the
MINIMUM 200 with my
name at #3 and only receive 5 replies each, I will make an
additional
$626.00! OK, now here is the fun part, each of those 625
persons post a
MINIMUM 200 letters with my name at #2 and they each only
receive 5 replies,
that just made me $3,125.00!!! Those
3,125 persons will all deliver this message to 200 newsgroups
with my name
at #1 and if still 5 persons per 200 newsgroups react I will
receive
$15,625,00!With an original investment of only $6.00!
AMAZING! When your
name is no longer on the list, you just take the latest
posting in the
newsgroups, and send out another $6.00 to names on the list,
putting your
name at number 6 again. And start posting again. The thing to
remember is:
do you realize that thousands of people all over the world
are joining the
internet and reading these articles
everyday?, JUST LIKE YOU are now!! So, can you afford $6.00
and see if it
really works?? I think so... People have said, "e;what if the
plan is played
out and no one sends you the money? So what! What are the
chances of that
happening when there are tons of new honest users and new
honest people who
are joining the internet and newsgroups everyday and are
willing to give it
a try?
Estimates are at 20,000 to 50,000 new users, every day, with
thousands of
those joining the actual internet.
Remember: play FAIRLY and HONESTLY and this will really work.HOW TO TURN $6 INTO $6,000!!!!!! READING THIS COULD CHANGE
YOUR LIFE!
I found this on a bulletin board and decided to try it. A
little while back,
I was browsing through newsgroups, just like you are now, and
came across an
article similar to this that said you could make thousands of
dollars within
weeks with only an initial investment of $6.00! So I thought,
Yeah right,
this must be a scam,but like most of us, I was curious, so I
kept reading.
Anyway, it said that you send $1.00 to each of the 6 names
and address
stated in the article. You then place your own name and
address in the
bottom of the list at #6, and post the article in at least
200 newsgroups.
(There are thousands) No catch, that was it. So after
thinking it over, and
talking to a few people first, I thought about trying it. I
figured: what
have I got to lose except 6
stamps and $6.00, right? Then I invested the measly $6.00.
Well GUESS
WHAT!!...
within 7 days, I started getting money in the mail! I was
shocked! I figured
it would end soon, but the money just kept coming in. In my
first week, I
made about $25.00. By the end of the second week I had made a
total of over
$1,000.00! In the third week I had over $10,000.00 and it's
still growing.
This is now my fourth week and I have made a total of just
over $42,000.00
and it's still coming in rapidly. It's certainly worth $6.00,
and 6 stamps,
I have spent more than that on the lottery!! Let me tell you
how this works
and most importantly, why it works....Also, make sure you
print a copy of
this article NOW, so you can get the information off of it as
you need it. I
promise you
that if you follow the directions exactly, that you will
start making more
money than you thought possible by doing something so easy!
Suggestion: Read this entire message carefully! (Print it out
or download
it.) Follow the simple directions and watch the money come
in! It's easy.
It's legal. And, your investment is only $6.00 (Plus postage)
IMPORTANT: This is not a rip-off; it is not indecent; it is
not illegal; and
it is virtually no risk - it really works!!!! If all of the
following
instructions are adhered to, you will receive extraordinary
dividends.
PLEASE NOTE: Please follow these directions EXACTLY, and
$50,000 or more can
be yours in 20 to 60 days. This program remains successful
because of the
honesty and integrity of the participants. Please continue
its success by
carefully
adhering to the instructions. You will now become part of the
Mail Order
business. In this business your product is not solid and
tangible, it's a
service. You are in the business of developing Mailing Lists.
Many large
corporations are happy to pay big bucks for quality lists.
However, the
money made from the mailing lists is secondary to the income
which is made
from people like you and me asking to be included in that
list. Here are the
4 easy steps to success:
STEP 1: Get 6 separate pieces of paper and write the
following on each piece
of paper; PLEASE PUT ME ON YOUR MAILING LIST. Now get 6 US
$1.00 bills and
place ONE inside EACH of the 6 pieces of paper so the bill
will not be seen
through the envelope (to prevent thievery). Next, place one
paper in each of
the 6 envelopes and seal them. You should now have 6 sealed
envelopes, each
with a piece of paper stating the above phrase, your name and
address, and a
$1.00 bill. What you are doing is creating a service. THIS IS
ABSOLUTELY
LEGAL! You are requesting a legitimate service and you are
paying for it!
Like most of us I was a little skeptical and a little worried
about the
legal aspects of it all. So I checked it out with the U.S.
Post Office
(1-800-725-2161) and they
confirmed that it is indeed legal! Mail the 6 envelopes to
the following
addresses:
Mailing Adresses
Stephanie Hicks
1283 Evening Canyon
Henderson NV 89014
Ross Wilson
202 Belmont Dr.
Thibodaux, LA 70301
James Small
4690 Sierra St.
Riverside, CA 92504
Thomas G.
P.O. Box 591939
Houston, TX 77259
S. Parker
159 Main Street
Dadeville, Alabama 36853
A. Wyman
9734 Landowne ct.
Orlando, FL 32817
STEP 2: Now take the #1 name off the list that you see above,
move the other
names up (6 becomes 5, 5 becomes 4, etc...) and add YOUR Name
as number 6 on
the list.
STEP 3: Change anything you need to, but try to keep this
article as close
to
original as possible. Now, post your amended article to at
least 200
newsgroups. (I think there are close to 24,000 groups) All
you need is 200,
but remember, the more you post, the more money you make!
This is perfectly
legal! If you have any doubts, refer to Title 18 Sec. 1302
& 1341 of the
Postal lottery laws. Keep a copy of these steps for yourself
and, whenever
you need money, you can use it again, and again.
PLEASE REMEMBER that this program remains successful because
of the honesty
and integrity of the participants and by their carefully
adhering to the
directions. Look at it this way. If you are of integrity, the
program will
continue and the money that so many others have received will
come your way.
NOTE: You may want to retain every name and address sent to
you, either on a
computer or hard copy and keep the notes people send you.
This VERIFIES that
you are truly providing a service. (Also, it might be a good
idea to wrap
the $1 bill in dark paper to reduce the risk of mail theft.)
So, as each
post is downloaded and the directions carefully followed, six
members will
be reimbursed for their participation as a List Developer
with one dollar
each. Your name will move up the list geometrically so that
when your name
reaches the #1 position you will be receiving thousands of
dollars in
CASH!!! What an opportunity for only $6.00 ($1.00 for each of
the first six
people listed above) Send it now, add your own name to the
list and you're
in business!
---DIRECTIONS ----- FOR HOW TO POST TO NEWSGROUPS------------
Step 1) You do
not need to re-type this entire letter to do your own
posting. Simply put
your cursor at the beginning of this letter and drag your
cursor to the
bottom of this document, and select 'copy' from the edit
menu. This will
copy the entire letter into the computer's memory.
Step 2) Open a blank 'notepad' file and place your cursor at
the top of the
blank page. From the 'edit' menu select 'paste'. This will
paste a copy of
the letter into notepad so that you can add your name to the
list.
Step 3) Save your new notepad file as a .txt file. If you
want to do your
postings in different settings, you'll always have this file
to go back to.
Step 4) Use Netscape or Internet explorer and try searching
for various
newsgroups (on-line forums, message boards, chat sites,
discussions.) Step
5) Visit these message boards and post this article as a new
message by
highlighting the text of this letter and selecting paste from
the edit menu.
Fill in the Subject, this will be the header that everyone
sees as they
scroll through the list of postings in a particular group,
click the post
message button. You're done with your first one!
Congratulations...THAT'S
IT! All you have to do is jump to different newsgroups and
post away, after
you get the hang of it, it will take about 30 seconds for
each newsgroup!
**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY
YOU WILL MAKE!!
BUT YOU HAVE TO POST A MINIMUM OF 200**
That's it! You will begin receiving money from around the
world within days!
You may eventually want to rent a P.O.Box due to the large
amount of mail
you will receive. If you wish to stay anonymous, you can
invent a name to
use, as long as the postman will deliver it.
**JUST MAKE SURE ALL THE ADDRESSES ARE CORRECT.** Now the WHY
part: Out of
200 postings, say I receive only 5 replies (a very low
example). So then I
made $5.00 with my name at #6 on the letter. Now, each of
the 5 persons who just sent me $1.00 make the MINIMUM 200
postings, each
with my name at #5 and only 5 persons respond to each of the
original 5,
that is another $25.00 for me, now those 25 each make 200
MINIMUM posts with
my name at #4 and only 5 replies each, I will bring in an
additional
$125.00! Now, those 125 persons turn around and post the
MINIMUM 200 with my
name at #3 and only receive 5 replies each, I will make an
additional
$626.00! OK, now here is the fun part, each of those 625
persons post a
MINIMUM 200 letters with my name at #2 and they each only
receive 5 replies,
that just made me $3,125.00!!! Those
3,125 persons will all deliver this message to 200 newsgroups
with my name
at #1 and if still 5 persons per 200 newsgroups react I will
receive
$15,625,00!With an original investment of only $6.00!
AMAZING! When your
name is no longer on the list, you just take the latest
posting in the
newsgroups, and send out another $6.00 to names on the list,
putting your
name at number 6 again. And start posting again. The thing to
remember is:
do you realize that thousands of people all over the world
are joining the
internet and reading these articles
everyday?, JUST LIKE YOU are now!! So, can you afford $6.00
and see if it
really works?? I think so... People have said, "e;what if the
plan is played
out and no one sends you the money? So what! What are the
chances of that
happening when there are tons of new honest users and new
honest people who
are joining the internet and newsgroups everyday and are
willing to give it
a try?
Estimates are at 20,000 to 50,000 new users, every day, with
thousands of
those joining the actual internet.
Remember: play FAIRLY and HONESTLY and this will really work. -
When I define a variable in BO it automatically turns it into a detail
i have made a user prompt in my report
so the user can input a value that does not exist in universe so i can use it as condition or a filter,
i have done this by using the followiing condition in the query
object = object
or
object = ToPrompt("Give number")
As you can see by the logic this condition will ALWAYS be true because object = object is always true. So this logic will not impact the rest of the query it will just allow to enter any value in the user prompt
in the report when i try to create a new variable
=ToNumber(UserResponse ("Query 1 with NEW_UNIV" , "Give number"))
it automatically turns it into a detail and i cant change it to measure or dimension.
is there a way to fix this
thanks in advancesome one answered in the following link
[When I define a variable in BO it automatically turns it into a detail; -
How to convert an sql query into a recordset?
HI, I'm having a hard time building a locations of service form for users to insert, update the cities, counties, zip codes based on the states selected.
so I found this query that works great if I use basic menus and text boxes, but can't use to make comma separated menus because it is nat a record set.
The problem is that I have a table called zip_codes, with the following fields: state_label, Zip_b, county, city.
zip codes correspond to the cities, counties and states.
example:
Colorado, Colorado Springs, El Paso, 80918
Users make a selection of state or states and the recordset is filtered by user selection.
I manage the part of making a select mutiple drop menu that passes the values to my query page like this.
<form action="litsTA.php"; method="post">
<h3>Choose State(s)</h3>
<p>hold Control key to select multiple states</p>
<select name="States_served[]_<?php echo $cnt1; ?>" multiple="multiple" onchange='showselection()'>
<?php
do {
?>
<option value="<?php echo $row_state['state_label']?>"><?php echo $row_state['state_label']?></option>
<?php
} while ($row_state = mysql_fetch_assoc($state));
$rows = mysql_num_rows($state);
if($rows > 0) {
mysql_data_seek($state, 0);
$row_state = mysql_fetch_assoc($state);
?>
</select>
<p>
<input type="submit" value="submit" />
</p>
</form>
And the query I need to convert into a recordset looks like this
mysql_select_db($database_duitop, $duitop);
$query_TONY = "SELECT * FROM zip_code WHERE state_label IN (";
for ($i=0; $i<=count($state_list)-1; $i++) {
//echo $state_list[$i];
$query_TONY = $query_TONY . "'" . $state_list[$i] . "'";
if ($i < count($state_list)-1) {
$query_TONY = $query_TONY . ", ";
$query_TONY = $query_TONY . ") GROUP BY county ORDER BY state_label, city ASC";
Any way that was my attempt to converting the query into a recordset.
any help, or samples will be appreciated.Use Tcode SQ01.
Give the query name press Enter.
The query will be listed in the table below.
Select the Query => From the Main menu select QUERY => More Functions => Display Report Name.
You will get the program name, now go to Se38 and display the program... -
How to simplify this query into simple sql select stmt
Hi,
Please simplify this query
I want to convert this query into single select statement. Is it possible?
If uarserq_choice_ind is not null then
Select ubbwbst_cust_code
From ubbwbst,utrchoi
Where utrchoi_prop_code=ubbwbst_cancel_prod
Else
Select max(utvsrvc_ranking)
From utvsrvc,ubbwbst
Where utvsrvc_code=ubbwbst_cancel_prod
End ifThough i have not tested this statement if mine ...but you can try at your end and let me know whether u got the desired output or not.
Select Decode(uarserq_choice_ind,Null,max_rnking,ubbwbst_cust_code)uarserq_chc
from
(Select max(utvsrvc_ranking)max_rnking,uarserq_choice_ind,ubbwbst_cust_code
From utvsrvc,ubbwbst,utrchoi
Where utvsrvc_code=ubbwbst_cancel_prod
Or utrchoi_prop_code=ubbwbst_cancel_prod
group by uarserq_choice_ind,ubbwbst_cust_code)
Best of Luck.
--Vineet -
Help with SQL query into Crystal
Afternoon all,
I am trying to convert the following SQL query into Crystal by using the tables given in the query however the relationship given in the query is bit awkward, in a sense that I cannot create a relationship under Crystal desgin.
Here is the query
select count(order_progressed.order_no),reason_code
from order_progressed,lab_reasons, rework_groups
where
order_progressed.date_created=Today
and (order_progressed.order_status=from_gate
and lab_reasons.reason_code between from_reason and to_reason)
group by lab_reasons.reason_code
order by 2
We have three tables
1: Order_Progressed
2: Lab Reasons
3: Rework_Groups
Order_progressed can be linked with rework_group by Status (if you see the line order_progressed.order_status=from_gate)
However how to link the following line?
lab_reasons.reason_code between from_reason and to_reason
I mean when I try to link it by Lab Reasons.Reason Code to From_reason, to reason, it doesn't seem to work.
The report is grouped by Lab Reasons. Reason Code, so I really have to some how create a relationship between Lab Reasons table and Rework_Group table.
This is what I get when I run the same query into Crystal using the relationship
SELECT lab_reasons.reason_code, order_progressed.date_created, order_progressed.order_no
FROM maxmast.lab_reasons lab_reasons, kevin.order_progressed order_progressed,
roger.rework_groups rework_groups
WHERE (order_progressed.order_status=rework_groups.from_gate) AND
((lab_reasons.reason_code=rework_groups.from_reason) AND
(lab_reasons.reason_code=rework_groups.to_reason)) AND (order_progressed.date_created>={ts
'2008-01-01 00:00:00'} AND order_progressed.date_created<={ts '2008-12-17 00:00:00'})
Any ideas?
Many thanks
Kind Regards
JehanzebSastry I didn't understand why did you use Lab_reasons.reason_code twice in your SQL.
What I have done since I posted this thread,
I created a command like this
Select *
from rework_groups,lab_reasons
where
lab_reasons.reason_code between from_reason and to_reason
Then I took out the lab_reasons table and rework_groups table, then I linked the order_status from Order_progressed table to From_gate of the newly created table (I called it Reason_Code).
This made the report running but it is crunching quite allot of numbers. I wonder if I made a mistake somewhere?
Oh and please note, I'd like to create an SQL (if need be) without the date entry which was done in the original SQL because I'd like to setup my own date range within Crystal Reports instead of getting passed by SQL itself.
This is how it looks like in Crystal now.
sae1_live
SELECT order_progressed.date_created, order_progressed.order_no, order_progressed.order_status
FROM kevin.order_progressed order_progressed
WHERE (order_progressed.date_created>={ts '2008-01-01 00:00:00'} AND
order_progressed.date_created<={ts '2008-12-17 00:00:00'})
EXTERNAL JOIN order_progressed.order_status={?sae1_live: Reason_Code.from_gate}
sae1_live
Select *
from rework_groups, lab_reasons
where lab_reasons.reason_code between from_reason and to_reason
EXTERNAL JOIN Reason_Code.from_gate={?sae1_live: order_progressed.order_status}
Regards
Jehanzeb -
Transform sap query into transaction
hi!
my question is not related to mm but also not to other forums in this site.
i'm trying to transform sap query into transaction using se93 transaction.
i just learing sap in a class and we use an old version of sap.
user group name: ofer6
infoset name: ofer9
query name: ofer8
all created in global area
when i enter se93 i write t-code ZSTART and press "create".
then i choose: "transaction with parameters" in the popup window.
in the second screen i write the transaction ZSTART again.
i mark "skip initial screen" and "inherit gui attributes"
at the bottom of the page in "default values" i use the following:
D_SREPOVARI-EXTDREPORT OFER8
D_SREPOVARI-REPORT OFER6 G
D_SREPOVARI-REPORTTYPE AQ
when i press enter i get messages:
transaction ZSTART does not exist
Screen 0000 of program does not exist
The field D_SREPOVARI-REPORTTYPE does not exist on the called screen
The field D_SREPOVARI-REPORT does not exist on the called screenHi,
Please check the link below:
http://www.freesaptutorial.com/how-to-create-transaction-code-in-sap-using-se93/
Hope this will be helpful to you.
Thanks,
Neeraj -
I need help making a query into a recordset
I have a detail page with a query that uses the "IN" statement to select from multiple states from the state_label field in my table
and display the zips, cities, and counties related to those states.
The query works great if I use regular menus with a single selection, but I need a comma separated menu
to be used to allow for multiple zips, cities and counties to be selected.
In order to make a texbox into a comma separated menu, I need to define my recordset to retrieve the values, I just can't figure out how to make amy query into a recordset.
This is the query.
<?php require_once('../Connections/duitop.php'); ?>
<?php $state_list = $_REQUEST['States_served']; ?>
<?php
mysql_select_db($database_duitop, $duitop);
$query_TONY = ("SELECT * FROM zip_code WHERE state_label IN (";
for ($i=0; $i<=count($state_list)-1; $i++) {
//echo $state_list[$i];
$query_TONY = $query_TONY . "'" . $state_list[$i] . "'";
if ($i < count($state_list)-1) {
$query_TONY = $query_TONY . ", ";
$query_TONY = $query_TONY . ") GROUP BY county ORDER BY state_label, city ASC");
?>
CAn any one please help with this problem , I've been trying for a week with no luck.
This is the way my detail page looks like.
Cities, Counties, and Zipcodes in your statesAs far as I know this will be included in the next ISO release. I solved it by manually bringing the dmraid package to the install and wrote a guide on installing your root system on dmraid. However when the system crashes I have the slight inconvenience of having to install dmraid and manually mount the sets to do a recovery. I guess this is the part you want to get rid of aswell. I decided to wait until the next holy ISO.
-
Notification Query for Item Group
Dear Experts,
Please Guide me for a Notification Query for this Scenario :
I want to put a Notification Query for a Group i.e. when any user do transactions in any form or any Particular form using items
of this Group than if the Item Quantity is in Decimal then he can not do that Transaction and Get Error Message.
Thanks in Advance.
Atul ChakrabortyHi Atul,
to achieve this you have to write SPTN at the back end
under databases node select your live database.
Select programability
select stored procedure
select db.sbo.SP_Transactionnotification
and paste your code into
ADD YOUR CODE AREA
If (@object_type = '17') and (@transaction_type in ('A', 'U'))
BEGIN
Declare @ItmGrpCode as int
Declare @Qty as int
set @ItmGrpcode = (select oitm.itmsgrpcod from oitm inner join rdr1 on oitm.itemcode = rdr1.itemcode inner join ordr on
rdr1.docentry = ordr.docentry where ordr.docentry=@list_of_cols_val_tab_del)
set @Qty = (select quantity from rdr1 inner join ordr on ordr.docentry = rdr1.docentry where ordr.docentry =
@list_of_cols_val_tab_del)
BEGIN
if @ItmGrpcode = 10 and @qty = 0
Begin
set @error = -1
set @error_message = 'Invalid Input'
End
End
END
Like wise by capturing object type and dml mode you have to write code for every document that you want to check.
For example I've given code for Sales Order.
hope this will help you
Thanking you
Malhaar' -
Inserting results from select query into another table
Hi: Is there a way to insert results returned from a SQL query into another table within the same SQL statement.
For example
SELECT a.SRCID,
SUM(DECODE(a.CLASS_ID,91147,1,0)) BLOCK,
SUM(DECODE(a.CLASS_ID,91126,1,0)) ALLOW,
FROM EVENT_DATA a
where
a.class_id in (91147,91126)
GROUP BY SRCID
order by TOTAL DESC;The columns returned SRCID, BLOCK and ALLOW need to go into another table called AGGREGATE_COUNT. This table has fields SRCID, BLOCK and ALLOW. Or is the only way this can be done from outside of SQL like using perl or C.
Thanks
RayINSERT INTO aggregate_count
( chart_id
, srcid
, block
, allow
SELECT 2234 chart_id
, srcid
, SUM(DECODE(class_id, 91147, 1, 0))
, SUM(DECODE(class_id, 91126, 1, 0))
FROM event_data
WHERE class_id IN (91147, 91126)
GROUP BY chart_id, srcid
ORDER BY total DESC; -
Plugging a sql query into OWB.
Hi,
I have a complex Sql query which returns some records. I want to use this query in OWB. But i don't want to write any procedures or functions. Is there a way just to plug this code into OWB to run it.
vasuAny objection to putting the query into a view?
The only other possible way I can think of that might work would be to create an expression object, define your desired output columns in the output group, and then copy in your query per column as the defined expression for that column. (hardly the efficient option!). I think you might have to create some sort of dummy input for this to pass through the validation for expressions too (e.g. perhaps also use a constant defined as sysdate passed as an input to the expression, but then never referenced in the queries).
Can't say for sure if you can fool OWB into using your query in an expression object or not - but that would be the only way I can think of which might be possible to avoid using a view/function/procedure. -
Turning contacts into iCloud contacts...
Hey All,
I've realised today that half of the contacts I've been making aren't iCloud contacts - I don't know what contacts they are but when I go to groups in the top left of the iPhone contacts screen and uncheck all but iCloud contacts some of them don't show up.
Is there a way of finding out what group these contacts are from and then turning them into iCloud contacts so that they sync across all my devices etc.?
CheersYou apparently didn't pay attention to the prompts you got when you plugged it in...
Restore the phone from YOUR backup. -
Turning class into loose expression
I have a class as you see below;
public class LoginScreen extends CustomNode{
var x;
override function create():Node{
loginGroup=Group{
content: [....
I want to turn it into a loose expression so like
var x;
function create(){
login group=Group{
content:[....
but when I change the code and run the application I can't see anything. What should I do and what are the things that I should consider before I change the class into a loose expressionI don't know. It's a reeeeaaallllyyyyyy good question and I'm SURE that is was never ever asked before on this forum. Let see I'll try to do a forum search to see if someone else ever thought about this.
Regards
Maybe you are looking for
-
What does it take to get a response from someone?
I sent a direct message to MatthewS_vzw 5 days ago and haven't heard a word yet! Has anyone else had trouble getting a response when they posted a question?
-
Create MII transaction & MII Web Service and consume them in ABAP
Hi, there is a document from Pradip Ray (SAP Labs India) published on SDN: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/208239ac-3161-2b10-f29a-abec6754942e He explains how to build a transaction in MII, expose it as a web serv
-
Hi Experts, We are planning to implement non dynamic Caching for data storage. Could anyone please suggest the best Java Collection to use in terms of speed and size? Thanks in advance Shagil
-
Delv qty greater than sales order qty
Hi , We are on ECC 6 . In one of the del, delivery qty is greater than sales order qty. which resulted in overpicking. ( Sales order qty 560 , delivery qty 587 & Pick qty 587). This is over delivery & overpicking issue. Is there any w
-
Hierachical tree - Highlight particular node's in Tree
Is there any way to bold or change the colour of particular nodes in a tree? We know and use the node icon to distinguish between them but ideally would want to bold some to highlight areas I can not see how to do this looking at the documentation bu