Help with this SQL Query please

How many garments has each dressmaker constructed? You should give the number of garments and the name, house number and post code of each dressmaker.
tables; dressmaker contains D_NO, D_NAME, D_HOUSE_NO, D_POST_CODE
garment contains STYLE_NO, DESCRIPTION, LABOUR_COST, NOTIONS
quantities contains STYLE_Q, SIZE_Q, QUANTITY
The question title is multitableJOINS
I believe i have to use (garment.style_no=quantities.style_q) if it will work, im new to oracle & SQL so all the help i get i am grateful for, thankyou.

Not to be a jerk, but this forum is really not intended for homework. Show a little effort, and try it out. Post some results, and maybe someone will help you out. Getting others to do your homework will not help you when you get out of school.

Similar Messages

  • Need help with this sql query

    the following query returns me the correct no of rows:
    select col1 from tab1 where
    col1 like '%'||chr(32)||'%';
    but i need to use my query in the following form and it doesn't return any row:
    select col1 from tab1 where
    col1 IN ('%'||chr(32)||'%');
    what am I doing worng?
    thanks in advance.

    Or in 10g (just recycling another example):
    WITH t AS (SELECT 'OPTI1457' || CHR(32) col1
                 FROM dual
                UNION
               SELECT 'OPT123' || CHR(9)
                 FROM dual
                UNION
               SELECT 'OPTIM12345'
                 FROM dual
    SELECT t.*
      FROM t
    WHERE REGEXP_LIKE(t.col1, CHR(32) || '|' || CHR(9))
    ;       C.

  • Help with an SQL Query on the Logger

    We are running UCCE 8.5(3) and need help with an SQL query. When I run the below I would also like to see skill group information(name preferably)? Any help would be greatly appreciated!
    select * from dbo.t_Termination_Call_Detail where DateTime between '10-11-2012 00:00:00:00' and
    '10-11-2012 23:59:59:59'

    David, thanks for replying.  Unfortunitly I don't know enough about SQL to put that into a query and have it return data.  Would you be able to give an example on what the query would look like?

  • Anybody can help with this SQL?

    The table is simple, only 2 columns:
    create table personpay(
    id integer primary key,
    pay number(8,2) not null);
    So the original talbe looks like this:
    ID PAY
    1 800
    2 400
    3 1200
    4 500
    5 600
    6 1900
    The requirement is to use one single query(no pl/sql) to show something lile the following, in other words, for each ID, the pay is the sum of all before itself and itself. So the query result looks like this:
    ID PAY
    1 800
    2 1200
    3 2400
    4 2900
    5 3500
    6 5400
    Again, just use one sql. No pl/sql. Anybody can help with this? I really appreciate that.
    thanks,

    Eh, people are so "analytically minded" that can't even notice a simple join?
    Counting Ordered Rows
    Let’s start with a basic counting problem. Suppose we are given a list of integers, for example:
    x
    2
    3
    4
    6
    9
    and want to enumerate all of them sequentially like this:
    x      #
    2      1
    3      2
    4      3
    6      4
    9      5
    Enumerating rows in the increasing order is the same as counting how many rows precede a given row.
    SQL enjoys success unparalleled by any rival query language. Not the last reason for such popularity might be credited to its proximity to English . Let examine the informal idea
    Enumerating rows in increasing order is counting how many rows precede a given row.
    carefully. Perhaps the most important is that we referred to the rows in the source table twice: first, to a given row, second, to a preceding row. Therefore, we need to join our number list with itself (fig 1.1).
    Cartesian Product
    Surprisingly, not many basic SQL tutorials, which are so abundant on the web today, mention Cartesian product. Cartesian product is a join operator with no join condition
    select A.*, B.* from A, B
    Figure 1.1: Cartesian product of the set A = {2,3,4,6,9} by itself. Counting all the elements x that are no greater than y produces the sequence number of y in the set A.
    Carrying over this idea into formal SQL query is straightforward. As it is our first query in this book, let’s do it step by step. The Cartesian product itself is
    select t.x x, tt.x y
    from T t, T tt
    Next, the triangle area below the main diagonal is
    select t.x x, tt.x y
    from T t, T tt
    where tt.x <= t.x
    Finally, we need only one column – t.x – which we group the previous result by and count
    select t.x, count(*) seqNum
    from T t, T tt
    where tt.x <= t.x
    group by t.x
    What if we modify the problem slightly and ask for a list of pairs where each number is coupled with its predecessor?
    x      predecessor
    2      
    3      2
    4      3
    6      4
    9      6
    Let me provide a typical mathematician’s answer, first -- it is remarkable in a certain way. Given that we already know how to number list elements successively, it might be tempted to reduce the current problem to the previous one:
    Enumerate all the numbers in the increasing order and match each sequence number seq# with predecessor seq#-1. Next!
    This attitude is, undoubtedly, the most economical way of thinking, although not necessarily producing the most efficient SQL. Therefore, let’s revisit our original approach, as illustrated on fig 1.2.
    Figure 1.2: Cartesian product of the set A = {2,3,4,6,9} by itself. The predecessor of y is the maximal number in a set of x that are less than y. There is no predecessor for y = 2.
    This translates into the following SQL query
    select t.x, max(tt.x) predecessor
    from T t, T tt
    where tt.x < t.x
    group by t.x
    Both solutions are expressed in standard SQL leveraging join and grouping with aggregation. Alternatively, instead of joining and grouping why don’t we calculate the count or max just in place as a correlated scalar subquery:
    select t.x,
    (select count(*) from T tt where tt.x <= t.x) seq#
    from T t
    group by t.x
    The subquery always returns a single value; this is why it is called scalar. The tt.x <= t.x predicate connects it to the outer query; this is why it is called correlated. Arguably, leveraging correlated scalar subqueries is one the most intuitive techniques to write SQL queries.
    How about counting rows that are not necessarily distinct? This is where our method breaks. It is challenging to distinguish duplicate rows by purely logical means, so that various less “pure” counting methods were devised. They all, however, require extending the SQL syntactically, which was the beginning of slipping along the ever increasing language complexity slope.
    Here is how analytic SQL extension counts rows
    select x, rank() over(order by x) seq# from T; -- first problem
    select x, lag() over(order by x) seq# from T; -- second problem
    Many people suggest that it’s not only more efficient, but more intuitive. The idea that “analytics rocks” can be challenged in many ways. The syntactic clarity has its cost: SQL programmer has to remember (or, at least, lookup) the list of analytic functions. The performance argument is not evident, since non-analytical queries are simpler construction from optimizer perspective. A shorter list of physical execution operators implies fewer query transformation rules, and less dramatic combinatorial explosion of the optimizer search space.
    It might even be argued that the syntax could be better. The partition by and order by clauses have similar functionality to the group by and order by clauses in the main query block. Yet one name was reused, and the other had been chosen to have a new name. Unlike other scalar expressions, which can be placed anywhere in SQL query where scalar values are accepted, the analytics clause lives in the scope of the select clause only. I have never been able to suppress an impression that analytic extension could be designed in more natural way.

  • Help with JSTL sql query

    i have a query that i want to pass a paramater to the query goes like this
    <sql:query var = "user" >
    SELECT AMOUNT,flag FROM SAVINGS_ACTIVITY_DETAILS WHERE ACCOUNT_ID =? AND AMOUNT >200000 AND Flag =1 AND ACCOUNT_ACTION_ID =6 AND Treated =0 ORDER BY created_date DESC
    <sql:param value="${test.accountId}"/>
    </sql:query>
    this will give an error on TLD attribute.................and i tested the value with the following code and it worked
    <c:set value="${test.accountId}" var="u"/>
    <c:out value="${u}"/>
    this will print out the value nicely now i need a way to be able to pass this value to the sql query
    Thanks

    Which version of jstl are you using? == JSTL1.1
    However the other two questions remain unanswered.
    What server are you using? Version?
    How are you importing the tag library?
    You can find out the server info with this snippet of a JSP:
    Working with server: <%= application.getServerInfo() %><br>
    Servlet Specification: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %> <br>
    JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
    Java Version: <%= System.getProperty("java.version") %><br>

  • Please help me with this SQL query

    I am practicing SQL queries and have come across one involving fetching data from 3 different tables.
    The three tables are as below
    <pre>
    Country
    location_id          country
    loc1          Spain
    loc2          England
    loc3          Spain
    loc4          USA
    loc5          Italy
    loc6          USA
    loc7          USA
    </pre>
    <pre>
    User
    user_id location_id
    u1 loc1
    u2 loc1
    u3 loc2
    u4 loc2
    u5 loc1
    u6 loc3
    </pre>
    <pre>
    Post
    post_id user_id
    p1 u1
    p2 u1
    p3 u2
    p4 u3
    p5 u1
    p6 u2
    </pre>
    I am trying to write an SQL query - for each country of users, display the average number of posts
    I understand the logic behind this that we first need to group together all the locations and then the users belonging to one country and then find the average of their posts.
    But, i'm having a difficulty in putting this in SQL form. Could someone please help me with this query.
    Thanks.

    select
    country.country,
    count(*) Totalpostspercountry,
    count(distinct post.user_id) Totaldistincuserspercountry,
    count(*)/count(distinct post.user_id) Avgpostsperuserbycountry
    from
    country, muser, post
    where country.location_id = muser.location_id
    and muser.user_id = post.user_id
    group by country.country
    The output is like this for your sample data - hope this is what you were looking for :)
    COUNTRY,TOTALPOSTSPERCOUNTRY,TOTALDISTINCUSERSPERCOUNTRY,AVGPOSTSPERUSERBYCOUNTRY
    England,1,1,1,
    Spain,5,2,2.5,

  • Help with T-SQL query

    I have 3 hierarchical tables. [Parent] ->[Child1]->[Child2]
    I have [Xref] table which stores the documents associated with these three tables. In the [Xref] table, the column “TypeID” defines to which table the document is associated with.
    Below is the table structure with some sample data.
    Question: Given parented I want to get all the documents associated with parent as well its children. My sql query uses Union and its working fine. But Is there any other simple way to re-write this query?
    (Note that this is just an example, the actual hierarchy is pretty long so my SQL is getting little messy and I want simplify it.)
    TYPES
    TypeID TypeName
    1 Parent
    2 Child1
    3 Child2
    TABLE - PARENT
    ParentID
    1
    2
    3
    TABLE - CHILD1
    Child1ID ParentID
    1 1
    2 1
    3 2
    TABLE - CHILD2
    Child2ID Child1ID
    1 1
    2 1
    3 2
    4 2
    XREF
    DocumentID TypeID LocatorID
    1 1 1
    2 1 2
    3 1 3
    4 2 1
    5 2 2
    6 2 3
    7 3 1
    8 3 2
    9 3 3
    10 3 4
    SELECT DocumentID FROM XREF X
    JOIN Parent P ON P.ParentID = x.LocatorID AND TypeID = 1 -- Parent
    WHERE P.ParentID = @ParentID
    UNION
    SELECT DocumentID FROM XREF X
    JOIN Child1 C1 ON C1.Child1ID = x.LocatorID AND TypeID = 2 -- Child1
    JOIN Parent P ON P.ParnetID = C1.ParentID
    WHERE P.ParentID = @ParentID
    UNION
    SELECT DocumentID FROM XREF X
    JOIN Child2 C2 ON C2.Child1ID = x.LocatorID AND TypeID = 3 -- Child2
    JOIN Child1 C1 ON C1.Child1ID = c2.Child1ID
    JOIN Parent P ON P.ParnetID = C1.ParentID
    WHERE P.ParentID = @ParentID

    Can you child span multiple levels? If yes, best way would be to use CTE
    see
    http://technet.microsoft.com/en-us/library/ms186243(v=sql.105).aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Newbie - help with a SQL query for a bar chart  - Originally posted in APEX

    I originally posted this in the APEX forum but someone there suggested this is more of a SQL question.  Anyone out there who can provide some assistance?
    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESC
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.
    Is this enough info for some assistance? Any help would really be appreciated.
    Thanks,
    Rachel

    Hi, Rachel,
    user10774102 wrote:
    I originally posted this in the APEX forum but someone there suggested this is more of a SQL question.  Anyone out there who can provide some assistance?
    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESCIs there a problem with the code above?
    It's curious that the WHERE clause includes "PROJECT_STATUS='6'", but there is no pivoted column for project_status='6', like there is for '1' through '5'. That's not necessarily a mistake, and it wouldn't raise an error in any case.
    Instead of
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')you could say
    where PROJECT_STATUS  IN ('1', '2', '3', '4', '5', '6')but that probably has nothing to do with your current problem.
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.Is that an Apex error message? Sorry, I don't know anything about Apex.
    If you can't get a more specific error message from Apex, then try debugging this statement in SQL*Plus. When you get it fixed, then you can copy it back into Apex.
    If this is a SQL problem, then you should be able to re-create the problem in pure SQL.
    If you can't re-create the problem in pure SQL, then it's probably an Apex problem, and belongs in the Apex forum, not here.
    I don't see anything obviously wrong with your code, but I can't tell if, for example, you spelled a column name wrong, or if something has the wrong data type
    Is this enough info for some assistance? Any help would really be appreciated.It wiould be better if you posted a completE script that people could run to re-create the problem, and to test their ideas.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Always say which version of Oracle (and any other software, such as Apex) you're using.

  • Newbie - need help with a SQL query for a bar chart

    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESC
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.
    Is this enough info for some assistance? Any help would really be appreciated.
    Thanks,
    Rachel

    Hello,
    This is more of an SQL question, rather than specifically APEX-related. It's notable that you say: I'm a new user on APEX with no real SQL knowledgeWhich is fine (we all have to start somewhere, afterall) but it might be worth de-coupling the problem from APEX in the first instance. I'd also strongly recommend either taking a course, reading a book (e.g. http://books.google.co.uk/books?id=r5vbGgz7TFsC&printsec=frontcover&dq=Mastering+Oracle+SQL&hl=en#v=onepage&q=Mastering%20Oracle%20SQL&f=false) or looking for a basic SQL tutorial - it will save you a whole lot of heartache, I promise you. Search the oracle forums for the terms "Basic SQL Tutorial" and you should come up with a bunch of results.
    Given that you've copied your query template from another, I would suggest ensuring that the actual query works first of all. Try running it in either:
    * SQL Editor
    * SQL*Plus
    * an IDE like SQL Developer (available free from the OTN: http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html ) or TOAD or similar.
    You may find there are syntax errors associated with the query - it's difficult to tell without looking at your data model.
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORYNote that your "order by" clause references a field called "PROJECT_ID", which exists in the old query but you've changed other similar references to "PROJECT_STATUS" - is it possible you've just missed this one? The perils of copy-paste coding I'm afraid...

  • New to Java and need help with this program..please!

    I'd really appreciate any helpful comments about this program assignment that I have to turn in a week from Friday. I'm taking a class one night a week and completely new to Java. I'd ask my professor for help, but we can't call him during the week and he never answers e-mails. He didn't tell us how to call from other classes yet, and I just can't get the darn thing to do what I want it to do!
    The assignment requirements are:
    1. Change a card game application that draws two cards
    and the higher card wins, to a Blackjack application
    2. Include a new class called Hand
    3. The Hand class should record the number of draws
    4. The application should prompt for a number of draws
    5. The game is played against the Dealer
    6. The dealer always draws a card if the dealer's hand total is <= 17
    7. Prompt the player after each hand if he wants to quit
    8. Display the total games won by the dealer and total and the total games wond by the player after each hand
    9. Display all of the dealer's and player's cards at the
    end of each hand
    10. Player has the option of drawing an additional card after the first two cards
    11. The Ace can have a value of 11 or 1
    (Even though it's not called for in the requirements, I would like to be able to let the Ace have a value of 1 or an 11)
    The following is my code with some comments about a few things that are driving me nuts:
    import java.util.*;
    import javax.swing.*;
    import java.text.*;
    public class CardDeck
    public CardDeck()
    deck = new Card[52];
    fill();
    shuffle();
    public void fill()
    int i;
    int j;
    for (i = 1; i <= 13; i++)
    for (j = 1; j <= 4; j++)
    deck[4 * (i - 1) + j - 1] = new Card(i, j);
    cards = 52;
    public void shuffle()
    int next;
    for (next = 0; next < cards - 1; next++)
    int rand = (int)(Math.random()*(next+1));
    Card temp = deck[next];
    deck[next] = deck[rand];
    deck[rand] = temp;
    public final Card draw()
    if (cards == 0)
    return null;
    cards--;
    return deck[cards];
    public int changeValue()
    int val = 0;
    boolean ace = false;
    int cds;
    for (int i = 0; i < cards; i++)
    if (cardValue > 10)
    cardValue = 10;
    if (cardValue ==1)     {
    ace = true;
    val = val + cardValue;
    if ( ace = true && val + 10 <= 21 )
    val = val + 10;
    return val;
    public static void main(String[] args)
    CardDeck d = new CardDeck();
    int x = 3;
    int i;
    int wins = 1;
    int playerTotal = 1;
    do {
    Card dealer = (d.draw());
    /**I've tried everything I can think of to call the ChangeValue() method after I draw the card, but nothing is working for me.**/
    System.out.println("Dealer draws: " + dealer);
    do {
    dealer = (d.draw());
    System.out.println(" " + dealer);
    }while (dealer.rank() <= 17);
    Card mine = d.draw();
    System.out.println("\t\t\t\t Player draws: "
    + mine);
    mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
    do{
    String input = JOptionPane.showInputDialog
    ("Would you like a card? ");
    if(input.equalsIgnoreCase("yes"))
         mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
         playerTotal++;
         else if(input.equalsIgnoreCase("no"))
    System.out.println("\t\t\t\t Player stands");
         else
    System.out.println("\t\tInvalid input.
    Please try again.");
    I don't know how to go about making and calling a method or class that will combine the total cards delt to the player and the total cards delt to the dealer. The rank() method only seems to give me the last cards drawn to compare with when I try to do the tests.**/
    if ((dealer.rank() > mine.rank())
    && (dealer.rank() <= 21)
    || (mine.rank() > 21)
    && (dealer.rank() < 22)
    || ((dealer.rank() == 21)
    && (mine.rank() == 21))
    || ((mine.rank() > 21)
    && (dealer.rank() <= 21)))
    System.out.println("Dealer wins");
    wins++;
         else
    System.out.println("I win!");
    break;
    } while (playerTotal <= 1);
    String stop = JOptionPane.showInputDialog
    ("Would you like to play again? ");
    if (stop.equalsIgnoreCase("no"))
    break;
    if (rounds == 5)
    System.out.println("Player wins " +
    (CardDeck.rounds - wins) + "rounds");
    } while (rounds <= 5);
    private Card[] deck;
    private int cards;
    public static int rounds = 1;
    public int cardValue;
    /**When I try to compile this nested class, I get an error message saying I need a brace here and at the end of the program. I don't know if any of this code would work because I've tried adding braces and still can't compile it.**/
    class Hand()
    static int r = 1;
    public Hand() { CardDeck.rounds = r; }
    public int getRounds() { return r++; }
    final class Card
    public static final int ACE = 1;
    public static final int JACK = 11;
    public static final int QUEEN = 12;
    public static final int KING = 13;
    public static final int CLUBS = 1;
    public static final int DIAMONDS = 2;
    public static final int HEARTS = 3;
    public static final int SPADES = 4;
    public Card(int v, int s)
    value = v;
    suit = s;
    public int getValue() { return value; }
    public int getSuit() { return suit;  }
    public int rank()
    if (value == 1)
    return 4 * 13 + suit;
    else
    return 4 * (value - 1) + suit;
    /**This works, but I'm confused. How is this method called? Does it call itself?**/
    public String toString()
    String v;
    String s;
    if (value == ACE)
    v = "Ace";
    else if (value == JACK)
    v = "Jack";
    else if (value == QUEEN)
    v = "Queen";
    else if (value == KING)
    v = "King";
    else
    v = String.valueOf(value);
    if (suit == DIAMONDS)
    s = "Diamonds";
    else if (suit == HEARTS)
    s = "Hearts";
    else if (suit == SPADES)
    s = "Spades";
    else
    s = "Clubs";
    return v + " of " + s;
    private int value; //Value is an integer, so how can a
    private int suit; //string be assigned to an integer?
    }

    Thank you so much for offering to help me with this Jamie! When I tried to call change value using:
    Card dealer = (d.changeValue());
    I get an error message saying:
    Incompatible types found: int
    required: Card
    I had my weekly class last night and the professor cleared up a few things for me, but I've not had time to make all of the necessary changes. I did find out how toString worked, so that's one question out of the way, and he gave us a lot of information for adding another class to generate random numbers.
    Again, thank you so much. I really want to learn this but I'm feeling so stupid right now. Any help you can give me about the above error message would be appreciated.

  • Help with translating SQL query from SQL Server syntax to Oracle syntax

    Hi,
    is it someone that can help me translate following SQL query from SQL Server syntax to Oracle syntax.
    SELECT ID,
    [LMT(MTR)] = MAX(case when TYPE = 'LMT' then VALUE end),
    [AAD(KGM)] = MAX(case when TYPE = 'AAD' then VALUE end),
    [VOL(MTQ)] = MAX(case when TYPE = 'VOL' then VALUE end)
    FROM yourtable
    GROUP BY ID
    Your help is highly appreciated, thanks in advance.

    Like this,
    SELECT ID,
    MAX(case when TYPE = 'LMT' then VALUE end) LMT_MTR,
    MAX(case when TYPE = 'AAD' then VALUE end) AAD_KGM ,
    MAX(case when TYPE = 'VOL' then VALUE end) VOL_MTQ
    FROM yourtable
    GROUP BY ID-Arun

  • Selection screen - search help with dynamic sql query

    hey ,
    is it possible to change the search help of the selection field ?
    when i create the range table i put a data element :
    create a range table that consists of this new data element
      LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME = 'S_CARR_ID' ).
    can i control the search help via the the data element or by other methods ?
    i want that when the user press F4 the values that will show is the result of a sql query that i will write .
    is it possible ?
    thanks
    ASA.

    Hi,
    yes it is possible...
    This is my test code for say personal number select options...
    lt_range_table = wd_this->m_handler->create_range_table(
      i_typename = 'PERSNO' ).
    add a new field to the selection
      wd_this->m_handler->add_selection_field(
      i_id = 'PERSNO'
    I_VALUE_HELP_TYPE = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
    I_VALUE_HELP_ID = 'ZHELP_WDA_PERNR'   "this is the custom search help we need to create
    I_NO_INTERVALS = abap_true
      it_result = lt_range_table
      i_read_only = read_only ).
    do the following:
    1) copy the std function module: F4IF_SHLP_EXIT....to ZF4IF_SHLP_EXIT_pernr (in my case i am testing for pernr so my fm
    name is like that....obviously it can be anything you want...under the recommended naming convention)
    2) look for "STEP SELECT"
    STEP SELECT    (Select values)
    3)write the code as follows:
    "NOTE: this is my testing code...but you can build your logic on it....
    IF CALLCONTROL-STEP = 'SELECT'.
    types: begin of zpri_listing,
    pernr type PERSNO,
    end of zfund_listing.
    DATA: lo_syuname TYPE sy-uname.
    data itab type standard table of Zpri_LISTING.
    data wa type zpri_listing.
        DATA : t_fields LIKE TABLE OF shlp_tab-fielddescr.
        DATA : w_fields LIKE LINE OF shlp_tab-fielddescr.
        DATA : l_fname TYPE dfies-lfieldname.
        IF lo_syuname <> sy-uname.  "means we were here before and ITAB is filled...fm retains its data values...unless refresh happens
    "this if condition make sure that we do not do this select all the time as long as the same user is logged in...
    "a user can press f4 many times...you might want to enhance this logic a little bit more for performance
          lo_syuname = sy-uname.
    ))))))))))))))HERE DO YOUR SELECT(((((((((((((((((((((
    select pernr from "sometable" into table itab.
        ENDIF.
        LOOP AT shlp_tab.
          LOOP AT shlp_tab-fielddescr INTO w_fields.
            l_fname = w_fields-fieldname.
            CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
              EXPORTING
                parameter               = w_fields-fieldname
              OFF_SOURCE              = 0
              LEN_SOURCE              = 0
              VALUE                   =
               fieldname               = l_fname
              TABLES
                shlp_tab                = shlp_tab
                record_tab              = record_tab
                source_tab              =  itab
              CHANGING
                shlp                    = shlp
                callcontrol             = callcontrol
             EXCEPTIONS
               parameter_unknown       = 1
               OTHERS                  = 2
          ENDLOOP.
        ENDLOOP.
        IF sy-subrc EQ 0.
          callcontrol-step = 'DISP'.
        ELSE.
          callcontrol-step = 'EXIT'.
        ENDIF.
        EXIT. "Don't process STEP DISP additionally in this call.
      ENDIF.
    4) save and activate this function module...
    5) go to se11 and create "Elementary srch hlp"....
    6) fill out all the necessary fields...i am assuming that you already know how to create the search helps...
    look for this field: "Search help exit" and put your function name which you created in the above steps...
    in this example i have: ZF4IF_SHLP_EXIT_pernr....
    7) create and activate the search help....
    hope this helps...i just tested this and it is working for me....
    Thanks..
    AS...

  • Can someone tell me what's wrong with this LOV query please?

    This query works fine..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = 'ADAM'
    But this one..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = apex_application.g_user
    Gives the following error.
    1 error has occurred
    * LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Thanks very much,
    -Adam vonNieda

    Ya know, I still don't know what's wrong with this.
    declare
    l_val varchar2(100) := nvl(apex_application.g_user,'ADAM');
    begin
    return 'select filter_name display_value, filter_id return_value
    from otmgui_filter where username = '''|| l_val || '''';
    end;
    Gets the same error as above. All I'm trying to do is create a dropdown LOV which selects based on the apex_application.g_user.
    What am I missing here?
    Thanks,
    -Adam

  • Help With Geodetic Rectangular Query Please

    I'm new to spatial so I appreciate your help.
    I have a 3D geodetic coordinate system defined that is index in 2D (lon & lat).
    I want to do a query that returns all points (lat, lon, alt) within the rectangle described by the query.
    I read in the "Oracle Spatial User's Guide" that this rectangle must have 5 points (since I'm using geodetic).
    I have not found a good example of how to format the query. Can you help with an example?

    here is an example which assume a wgs-84 coordinate system (srid=8307). Note that altitude will be ignored.
    select col1,col2,etc
    from geom_table
    where sdo_relate(geom,mdsys.sdo_geometry(2003,8307,NULL,
    mdsys.sdo_elem_info_array(1,1003,1),
    mdsys.sdo_ordinate_array(-70.05,40.8, -69.05,40.8, -69.05,41.2, -70.05,41.2, -70.05,40.8)),
    'mask=anyinteract querytype=window') = 'TRUE';

  • I need help with this crash log please

    If anyone can help I would appreciate it. Garage Band keeps crashing since I upgraded yesterday. I'm enclosing the crash log.
    Thanks
    derek
    Version: 2.0.2 (2.0.2 (50))
    Build Version: 14
    Project Name: GarageBand
    Source Version: 850000
    PID: 196
    Thread: 0
    Exception: EXCBADACCESS (0x0001)
    Codes: KERNINVALIDADDRESS (0x0001) at 0xffffffbc
    Thread 0 Crashed:
    0 libSystem.B.dylib      0x9003e708 strlcpy + 136
    1 ...apple.DfSearchEngineWrapper      0x6d076a78 std::vector<loop::SearchKey, std::allocator<loop::SearchKey> >::M_insert_aux(__gnu_cxx::__normaliterator<loop::SearchKey*, std::vector<loop::SearchKey, std::allocator<loop::SearchKey> > >, loop::SearchKey const&) + 300
    2 ...apple.DfSearchEngineWrapper      0x6d065778 -[DfSearchEngineInnerWrapper doSearch] + 556
    3 ...apple.DfSearchEngineWrapper      0x6d068310 -[DfSearchEngineWrapper doSearch] + 60
    4 com.apple.garageband      0x000a0404 _code_start_ + 635380
    5 com.apple.AppKit      0x936a4d2c -[NSApplication sendAction:to:from:] + 108
    6 com.apple.garageband      0x000728f8 _code_start_ + 448232
    7 com.apple.garageband      0x00072b54 _code_start_ + 448836
    8 com.apple.garageband      0x000d232c _code_start_ + 839964
    9 com.apple.garageband      0x0007308c _code_start_ + 450172
    10 com.apple.garageband      0x000d1e28 _code_start_ + 838680
    11 com.apple.AppKit      0x9365f9c8 -[NSWindow sendEvent:] + 4616
    12 com.apple.AppKit      0x93608bfc -[NSApplication sendEvent:] + 4172
    13 com.apple.garageband      0x000217c4 _code_start_ + 116148
    14 com.apple.AppKit      0x93600090 -[NSApplication run] + 508
    15 com.apple.AppKit      0x936f08bc NSApplicationMain + 452
    16 com.apple.garageband      0x00027a08 _code_start_ + 141304
    17 com.apple.garageband      0x00005410 _code_start_ + 512
    18 com.apple.garageband      0x00005240 _code_start_ + 48
    Thread 1:
    0 libSystem.B.dylib      0x9002ca78 semaphorewait_signaltrap + 8
    1 libSystem.B.dylib      0x9003125c pthreadcondwait + 508
    2 com.apple.Foundation      0x9288a0a0 -[NSConditionLock lockWhenCondition:] + 68
    3 com.apple.AppKit      0x936a07f8 -[NSUIHeartBeat _heartBeatThread:] + 324
    4 com.apple.Foundation      0x92882f34 forkThreadForFunction + 108
    5 libSystem.B.dylib      0x9002c3b4 pthreadbody + 96
    Thread 2:
    0 libSystem.B.dylib      0x9000a738 machmsgtrap + 8
    1 libSystem.B.dylib      0x9000a67c mach_msg + 60
    2 com.apple.CoreFoundation      0x9074b338 __CFRunLoopRun + 832
    3 com.apple.CoreFoundation      0x9074ac3c CFRunLoopRunSpecific + 268
    4 com.apple.audio.CoreAudio      0x913a61dc HALRunLoop::OwnThread(void*) + 264
    5 com.apple.audio.CoreAudio      0x913a5f7c CAPThread::Entry(CAPThread*) + 96
    6 libSystem.B.dylib      0x9002c3b4 pthreadbody + 96
    Thread 3:
    0 libSystem.B.dylib      0x90056418 semaphoretimedwait_signaltrap + 8
    1 libSystem.B.dylib      0x900723b0 pthreadcond_timedwait_relativenp + 592
    2 com.apple.audio.CoreAudio      0x913b6f80 CAGuard::WaitFor(unsigned long long) + 204
    3 com.apple.audio.CoreAudio      0x913b6e90 CAGuard::WaitUntil(unsigned long long) + 304
    4 com.apple.audio.CoreAudio      0x913b5100 HP_IOThread::WorkLoop() + 852
    5 com.apple.audio.CoreAudio      0x913b4d98 HPIOThread::ThreadEntry(HPIOThread*) + 16
    6 com.apple.audio.CoreAudio      0x913a5f7c CAPThread::Entry(CAPThread*) + 96
    7 libSystem.B.dylib      0x9002c3b4 pthreadbody + 96
    Thread 4:
    0 libSystem.B.dylib      0x90056418 semaphoretimedwait_signaltrap + 8
    1 libSystem.B.dylib      0x900723b0 pthreadcond_timedwait_relativenp + 592
    2 ...ple.CoreServices.CarbonCore      0x90b6c728 TSWaitOnSemaphoreCommon + 176
    3 ...ple.CoreServi

    I'm still suffering with this problem. I've tried many things but to no avail and would like to be able to use Garage band. I've renstalled Quicktime and reverted to an older version as well but nothing seems to help including logging in as a new user.
    If anyone can help I would be very happy.
    Thanks
    Derek

Maybe you are looking for