Need help writting advanced query.

I am trying to make a column of a dynamic table display a
record count from a diffrent table, limited by the Id number from
the first table....
The dynamic table displays all records of mysql table `List`
List.id
List.name
I have a second mysql table `index`.
One of the columns of `index` is named Number and contains a
number that corosponds to a List.id record.
I have added a new column to the dynamic table
List.id | List.name | new column
I would like this new column to be a number. Which is the
number of records in mysql table `index` that contain the List.id
of that row...
Currently I can limit the recordset query by a entered
value..1,2,3 etc...
But I do not know how to filter or limit by the List.id of
the current row...
I tried this advanced query to no use...as it is not valid.
SELECT *
FROM `index`
WHERE Number = `List`.id
Thank you in advance for looking and for any help anyone can
give.
Saw

Saw_duuhst wrote:
> I am trying to make a column of a dynamic table display
a record count from a
> diffrent table, limited by the Id number from the first
table....
>
> The dynamic table displays all records of mysql table
`List`
> List.id
> List.name
>
> I have a second mysql table `index`.
> One of the columns of `index` is named Number and
contains a number that
> corosponds to a List.id record.
>
> I have added a new column to the dynamic table
> List.id | List.name | new column
>
> I would like this new column to be a number. Which is
the number of records in
> mysql table `index` that contain the List.id of that
row...
>
> Currently I can limit the recordset query by a entered
value..1,2,3 etc...
> But I do not know how to filter or limit by the List.id
of the current row...
>
> I tried this advanced query to no use...as it is not
valid.
> SELECT *
> FROM `index`
> WHERE Number = `List`.id
>
> Thank you in advance for looking and for any help anyone
can give.
> Saw
You need to combine the 2 tables using a JOIN and then use a
GROUP BY
with a COUNT in the SELECT.
Try this:
SELECT list.List.id, list.List.name, COUNT(index.List.id) AS
ListCount
FROM index INNER JOIN list ON index.List.id = list.List.id
GROUP BY list.List.id, list.List.name
Dooza

Similar Messages

  • Need help with advanced Query

    I am stuck on a query and hope someone can help me out with
    it. Basically I am trying to get the average score by team who has
    competed in four or more events.
    So far I have my query doing a join to pull in the teams name
    and their category. What I want to do is be able to count the
    unique locations and do an average of the four highest scores on a
    field called overall.
    I have tried putting a couple different COUNT in my query's
    WHERE statement but it errors out.
    Any ideas? Some how I have a feeling I need to create a new
    table.
    Thanks

    chieffan wrote:
    > I am stuck on a query and hope someone can help me out
    with it. Basically I am
    > trying to get the average score by team who has competed
    in four or more events.
    >
    > So far I have my query doing a join to pull in the teams
    name and their
    > category. What I want to do is be able to count the
    unique locations and do an
    > average of the four highest scores on a field called
    overall.
    >
    > I have tried putting a couple different COUNT in my
    query's WHERE statement
    > but it errors out.
    >
    > Any ideas? Some how I have a feeling I need to create a
    new table.
    >
    > Thanks
    You need to use GROUP BY. Will need to know more specifics
    about the
    table construction along with sample data, and an example of
    the
    expected results.
    Dooza

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • Need to write a query while configuring Database Adapter

    Hi,
    I am working in BPEL.i need to write a query while configuring the DB adapter. i need to query a table which contains five rows each row containing 7 columns. my query should be like if i give the first column name(for eg:Title) it should return the complete row(i.e all the 7 columns in a row).
    So after deploying during testing when i give the Column name(Title) in the BPEL console it should return the row.
    How to write a query such tht if i give any title name in the five rows it should return the respective row
    please help me out.
    Regards,
    Mohamed

    Hi,
    I got the answer for this.its working fine now.
    the query is: select TITLE,..... from movie where (TITLE =#title);
    The second "title" will be the one which i am going to give in bpel console
    so it wil check with the "TITLE" in the table and execute the query.
    Regards,
    Mohamed

  • Need help writing a query for following scenario

    Hi all, I need some help writing a query for the following case:
    One Table : My_Table
    Row Count: App 5000
    Columns of Interest: AA and BB
    Scenario: AA contains some names of which BB contains the corresponding ID. Some
    names are appearing more than once with different IDs. For example,
    AA BB
    Dummy 10
    Me 20
    Me 30
    Me 40
    You 70
    Me 50
    Output needed: I need to write a query that will display only all the repeating names with their corresponding IDs excluding all other records.
    I would appreciate any input. Thanks

    Is it possible to have a records with the same values for AA and BB? Are you interested in these rows or do you only care about rows with the same value of AA and different BB?
    With a slight modification of a previous posting you can only select those rows that have distinct values of BB for the same value of AA
    WITH t AS (
    SELECT 'me' aa, 10 bb FROM dual
    UNION ALL
    SELECT 'me' aa, 20 bb FROM dual
    UNION ALL
    SELECT 'you' aa, 30 bb FROM dual
    UNION ALL
    SELECT 'you' aa, 30 bb FROM dual
    SELECT DISTINCT aa, bb
      FROM (SELECT aa, bb, COUNT(DISTINCT bb) OVER(PARTITION BY aa) cnt FROM t)
    WHERE cnt > 1;

  • Need help defining a query

    Hi everyone...
    I need help with this query. The table 'cobros' has a primary key defined by id_cliente + id_cobro. I pretend to classify rows by COUNT(id_cobro) which are between a date range.
    A client could have 1 or 2 or 3 rows per day, no more for a specific date. I would like to get first, all clients with COUNT(id_cobro) = 1, all clients with COUNT(id_cobro) = 2, and finally all clients with COUNT(id_cobro) = 3.
    Something similar to:
    1 SELECT id_cliente, COUNT(id_cobro) FROM cobros
    2 WHERE fecha_proximo_cobro >= '2011-05-30 00:00'
    3 AND fecha_proximo_cobro <= '2011-05-30 23:59'
    4 AND COUNT(id_cobro) = 1
    5 GROUP BY id_cliente
    The fourth line is the problem. It doesn't work.
    Thanks in advance!!!
    Mario

    Maybe you are looking for something like this?
    SELECT id_cliente
         , COUNT(*)   AS cnt
    FROM   cobros
    WHERE  fecha_promixo_cobro BETWEEN TO_DATE('2011-05-30 00:00','YYYY-MM-DD HH24:MI') AND TO_DATE('2011-05-30 23:59','YYYY-MM-DD HH24:MI')
    GROUP BY id_cliente
    ORDER BY 2
           , 1Also, NEVER rely on implicit data type conversion as you have (you provide a STRING not a DATE).
    Edited by: Centinul on Jun 2, 2011 12:36 PM
    Fixed syntax error.

  • !!!PLEASE HELP!! I NEED HELP UNLOCKING ADVANCE OPTION IN BIOS LENOVO G40-70

    i cant do anything in my bios on my lenovo g40-70 i need help unlocking advance options in bios,i tried flashing it but something in the system is preventing it from flashing.can you guys relase an update fixing that or relasse an update to enable us chane our video memory on our bios............thankssssssssssssssssssssssssss in ADVANCE!

    Welcome to the Lenovo Community !
    What BIOS update are you trying to do...... the Lenovo 9ACN29WW release or one that someone created for you over at BIOS-Mods?
    Are you getting any error messages in regards to the update failing ?
    Owner & Operator of the following:
    ● Lenovo Ideapad Z570 w/ Win 7 & Win 8.1 Dual Boot ● Lenovo Yoga 3 Pro w/ Windows 8.1 ● Toshiba A75-S206 w/ Win 7
    ● IBM Thinkpad T-23 w/ Win XP ● IBM Thinkpad T-22 w/ Win XP • As well as multiple desktops dual/triple booting XP, Vista and Win 7.
    ★ Find a post helpful? Thank that member by clicking on the ☆Star☆ to the left awarding them a Kudo.
    ★ Posting a problem and a reply is helpful and it answers your question, please mark it as an "Accepted Solution"
    ★ I'm not a Lenovo employee, just a volunteer geek who likes to help folks. Enjoy your time here, pay it forward by helping others !
    ★ Sorry, I don't answer questions via Private Messages. Posting in the appropriate forum is the best way to get assistance.

  • I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year

    I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year

    Hi Arun ,
    Can you explain little bit more ??
    what is account doc no? 
    what are the transactions should be displayed in your output??
    -Rajesh N

  • Need Help on below Query.

    Hi All,
    Need Help on below Query.
    Consider,
    "test9" Table Data in COLUMN "Name" AS
    Name
    =====
    'a'
    'b'
    'c'
    'd'
    'e'
    I am writing a query as :
    SELECT * FROM test9 WHERE Name IN ('a','b','c','d','e','f','g')
    I want result set as , It should show data as -
    'f'
    'g'
    i.e. data which does not exists in the table and which is give in in clause
    Is it possible in a single query.

    You can put the data that is to be checked for into a table instead or an inline view, for example:
    with t as
    (select 'a' as c1 from dual
    union all
    select 'b' from dual
    union all
    select 'c' from dual
    union all
    select 'd' from dual
    union all
    select 'e' from dual)
    select c1 from (select 'a' as c1 from dual
    union all
    select 'b' from dual
    union all
    select 'c' from dual
    union all
    select 'd' from dual
    union all
    select 'e' from dual
    union all
    select 'f' from dual
    union all
    select 'g' from dual)
    minus
    select c1 from t
    C
    f
    g
    2 rows selected.

  • Please, need help with a query

    Hi !
    Please need help with this query:
    Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
    Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
    select distinct a.id,
    create_date,
    a.loanid,
    a.rate,
    a.pays,
    a.gracetime,
    a.emailtosend,
    d.first_name,
    d.last_name,
    a.user_id
    from CLAL_LOANCALC_DET a,
    loan_Calculator b,
    bv_user_profile c,
    bv_mr_user_profile d
    where b.loanid = a.loanid
    and c.NET_USER_NO = a.resp_id
    and d.user_id = c.user_id
    and a.is_partner is null
    and a.create_date between
    TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
    TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    order by a.create_date

    Take a look on the syntax :
    max(...) keep (dense_rank last order by ...)
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions056.htm#i1000901
    Nicolas.

  • Please need help with this query

    Hi !
    Please need help with this query:
    Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
    Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
    select distinct a.id,
    create_date,
    a.loanid,
    a.rate,
    a.pays,
    a.gracetime,
    a.emailtosend,
    d.first_name,
    d.last_name,
    a.user_id
    from CLAL_LOANCALC_DET a,
    loan_Calculator b,
    bv_user_profile c,
    bv_mr_user_profile d
    where b.loanid = a.loanid
    and c.NET_USER_NO = a.resp_id
    and d.user_id = c.user_id
    and a.is_partner is null
    and a.create_date between
    TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
    TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    order by a.create_date

    Perhaps something like this...
    select id, create_date, loanid, rate, pays, gracetime, emailtosend, first_name, last_name, user_id
    from (
          select distinct a.id,
                          create_date,
                          a.loanid,
                          a.rate,
                          a.pays,
                          a.gracetime,
                          a.emailtosend,
                          d.first_name,
                          d.last_name,
                          a.user_id,
                          max(create_date) over (partition by a.user_id, a.loadid) as max_create_date
          from CLAL_LOANCALC_DET a,
               loan_Calculator b,
               bv_user_profile c,
               bv_mr_user_profile d
          where b.loanid = a.loanid
          and   c.NET_USER_NO = a.resp_id
          and   d.user_id = c.user_id
          and   a.is_partner is null
          and   a.create_date between
                TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
                TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    where create_date = max_create_date
    order by create_date

  • Calling SQL experts to help write a query

    Trying to find some help from some sql experts.
    I was asked to help write a query showing each Dialed_Number, the associated Call_Type, and Script(s) in an ICM configuration.
    All the data I’m looking for seems to be in the following tables:
    Dialed_Number (DialedNumberString, EnterpriseName, DialedNumberID)
    Call_Type (CallTypeID, EnterpriseName)
    Dialed_Number_Map (DialedNumberID, CallTypeID)
    Call_Type_Map (CallTypeID, MasterScriptID)
    Master_Script (MasterScriptID, EnterpriseName)
    Thus far, my query looks like this:
    SELECT     distinct Dialed_Number.DialedNumberString, Dialed_Number.EnterpriseName AS DN_Name, Call_Type.EnterpriseName AS Call_Type_Name,
                          Master_Script.EnterpriseName AS ScriptName
    FROM         Call_Type_Map CROSS JOIN
                          Call_Type CROSS JOIN
                          Dialed_Number CROSS JOIN
                          Dialed_Number_Map CROSS JOIN
                          Master_Script
    However, it’s returning every possible combination (it was 10x worse before adding the word ‘distinct’)
    Ideally, I’d like the results to just show one row for each Dialed_Number (assumes 1:1 ratio of DN to CallType).
    e.g.:
    DN_Name           DialedNumberString      CallType_Name                ScriptName
    Can anyone offer any guidance or suggestion?

    Thanks Geoff,
    I'd put this out on a couple different channels, and while yours is pretty good (I did remove the RoutingClientID from the where clause), I got another version that works just as well, and also includes DNs without CallTypes, and those which may have a CallType, but no script.
    SELECT dn.DialedNumberString, dn.EnterpriseName AS Dialed_Number_Name, ct.EnterpriseName AS Call_Type_Name, ms.EnterpriseName AS Script_Name
    FROM Dialed_Number dn
    LEFT OUTER JOIN Dialed_Number_Map dnm ON dn.DialedNumberID = dnm.DialedNumberID
    LEFT OUTER JOIN Call_Type ct ON dnm.CallTypeID = ct.CallTypeID
    LEFT OUTER JOIN Call_Type_Map ctm ON ct.CallTypeID = ctm.CallTypeID
    LEFT OUTER JOIN Master_Script ms ON ctm.MasterScriptID = ms.MasterScriptID
    I believe the "joins" are supposedly more efficient, too.
    Thanks for your contribution!

  • Need help activating Advanced Calling 1.0 on Verizon for iphone 6 business account

    I need help activating Advanced Calling 1.0 on Verizon for iphone 6 business account. I was on the phone with Verizon for over an hour and they can't figure out why it's not working. I'm trying to activate the Voice & Data and all I get is a spinning circle but it never actually works. Anyone have any ideas?

    I just pulled this from the Verizon page. Not sure if it applies to you or not, but it could explain part of your problem since you identify this as a business account.
    Q: Who is eligible for Advanced Calling 1.0?
    A: Any Verizon customer with a compatible phone and a postpaid calling plan is eligible. Please note that the following features are currently incompatible with Advanced Calling 1.0: Ringback Tones and Caller Name ID.  Additional incompatible features apply for Business and Government customers.

  • Need help th tuning query or re write the query--

    Hi,
    Need help to tune the below query or rewrite th query for reducing the execution time Please find the query and explain plan.
    QUERY
    explain plan FOR SELECT consumer_key,product_key,days_in_product,20100201 period_key FROM
    (SELECT consumer_key,
      product_key,
      days_in_product,
      row_number() over ( Partition BY consumer_key order by Days_in_product DESC) row_num
    FROM
      (SELECT consumer_key,
        product_key,
        SUM(no_ofdays) days_in_product
      FROM
        (SELECT pcv.consumer_key,
          pcv.product_key,
          pcv.product_consumer_valid_from,
          pcv.product_consumer_valid_to,
          DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from) period_start,
          DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959) period_end,
          CASE
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) BETWEEN 20100201000000 AND 20100228235959
            AND activation_date > to_Date(product_consumer_valid_to,'YYYYMMDDHH24MISS')
            THEN 0
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) BETWEEN 20100201000000 AND 20100228235959
            AND activation_date BETWEEN to_Date(product_consumer_valid_from,'YYYYMMDDHH24MISS') AND to_Date(product_consumer_valid_to,'YYYYMMDDHH24MISS')
            THEN
              --to_char(activation_date,'MON-YYYY')='PERIOD_ACTIVE'  and activation_date >= to_Date(product_consumer_valid_from,'YYYYMMDDHH24MISS') then
              (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_date(TO_CHAR(activation_date,'YYYYMMDDHH24MISS'),'YYYYMMDDHH24MISS') )
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) < 20100201000000
            THEN (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_Date(DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from),'YYYYMMDDHH24MISS') )
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) > 20100228235959
            THEN 0
            ELSE
              --unusual situation
              (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_Date(DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from),'YYYYMMDDHH24MISS') )
          END No_ofDays
        FROM cimtran.product_consumer_validity pcv,
          consumer_dimension cd
        WHERE pcv.consumer_key           =cd.consumer_key
        AND product_consumer_valid_to   >= 20100201000000
        AND product_consumer_valid_from <= 20100228235959
          --and product_consumer_valid_from > '20090801000000'
        ORDER BY consumer_key,
          product_key,
          product_consumer_valid_from
        ) a
      GROUP BY consumer_key,
        product_key
      ORDER BY consumer_key,
        product_key
    ) WHERE row_num=1 ;EXPLAIN PLAN
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 3823907703"
    "| Id  | Operation                | Name                      | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
    "|   0 | SELECT STATEMENT         |                           |  4665K|   231M|       |   133K  (1)| 00:31:08 |"
    "|*  1 |  VIEW                    |                           |  4665K|   231M|       |   133K  (1)| 00:31:08 |"
    "|*  2 |   WINDOW SORT PUSHED RANK|                           |  4665K|   173M|   232M|   133K  (1)| 00:31:08 |"
    "|   3 |    VIEW                  |                           |  4665K|   173M|       |   104K  (1)| 00:24:18 |"
    "|   4 |     SORT GROUP BY        |                           |  4665K|   182M|   729M|   104K  (1)| 00:24:18 |"
    "|*  5 |      HASH JOIN           |                           |    13M|   533M|    65M| 44241   (1)| 00:10:20 |"
    "|   6 |       TABLE ACCESS FULL  | CONSUMER_DIMENSION        |  2657K|    35M|       |  4337   (1)| 00:01:01 |"
    "|*  7 |       TABLE ACCESS FULL  | PRODUCT_CONSUMER_VALIDITY |    13M|   351M|       | 15340   (2)| 00:03:35 |"
    "Predicate Information (identified by operation id):"
    "   1 - filter(""ROW_NUM""=1)"
    "   2 - filter(ROW_NUMBER() OVER ( PARTITION BY ""CONSUMER_KEY"" ORDER BY "
    "              INTERNAL_FUNCTION(""DAYS_IN_PRODUCT"") DESC )<=1)"
    "   5 - access(""PCV"".""CONSUMER_KEY""=""CD"".""CONSUMER_KEY"")"
    "   7 - filter(""PRODUCT_CONSUMER_VALID_FROM""<=20100228235959 AND "
    "              ""PRODUCT_CONSUMER_VALID_TO"">=20100201000000)"

    I doubt that this query can be tuned without using indexes. There is a lot of unnecessary work specified in your query, like unnecessary intermediate sorting and selecting unused columns. The cost based optimizer recognized it and skips some of that unnecessary work, it seems. For clarity's sake, I would rewrite your query like below. Note that the query is untested:
    select consumer_key
         , max(product_key) keep (dense_rank last order by days_in_product) product_key
         , max(days_in_product) days_in_product
         , 20100201 period_key
      from ( select pcv.consumer_key
                  , pcv.product_key
                  , sum
                    ( case
                      when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) between 20100201000000 and 20100228235959
                      then
                        case
                        when cd.activation_date > to_date(pcv.product_consumer_valid_to,'yyyymmddhh24miss')
                        then
                          0
                        when cd.activation_date between to_date(pcv.product_consumer_valid_from,'yyyymmddhh24miss') and to_date(product_consumer_valid_to,'yyyymmddhh24miss')
                        then
                          to_date(to_char(pcv.product_consumer_valid_to),'yyyymmddhh24miss'))
                          - to_date(to_char(activation_date,'yyyymmddhh24miss'),'yyyymmddhh24miss')
                        end
                      when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) < 20100201000000
                      then
                        to_date(to_char(pcv.product_consumer_valid_to),'yyyymmddhh24miss'))
                        - to_date(to_char(pcv.product_consumer_valid_from),'yyyymmddhh24miss'))
                      when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) > 20100228235959
                      then
                        0
                      end
                    ) days_in_product
               from cimtran.product_consumer_validity pcv
                  , consumer_dimension cd
              where pcv.consumer_key             = cd.consumer_key
                and product_consumer_valid_to   >= 20100201000000
                and product_consumer_valid_from <= 20100228235959
              group by consumer_key
                  , product_key
    group by consumer_keyRegards,
    Rob.

  • Need help with the query to write Cipher?

    Hi, 
    I was assigned a task to write a query to encrypt and decrypt some Cipher.  I have figured out to write the procedure to encrypt and decrypt ceasar cipher. I would really appericate if you guys could help me out with this.
    .Caesar Cipher
    2.Monoalphabetic Cipher
    3.Playfair Cipher
    4.Vigenère Cipher
    5.Transposition Ciphers
    6.Rail Fence cipher
    7.Row Transposition Cipher

    Hi , 
    I sorry about just giving the names to when i resarched i saw Rail Fnce Cipher and Ceasar Cipher are the most easier ones.
    This is how rail fence cipher works .
    Codes and Ciphers :: Rail Fence
    In the rail fence cipher, the plaintext is written downwards on successive "rails" of an imaginary fence, starting a new column when the bottom is reached. The message is then read off in rows. For
    example, if we have 3 rails and a message of "This is a secret message", you would write out:
    T S A C T S G
    H I S R M S E
    I S E E E A J
    The last J is just a random letter to fill in the space. The secret message is then condensed and regrouped.
    TSACT SGHIS RMSEI SEEEA JGURL
    To decipher a message you must know the number of rails that were used to encipher it. You then break up the letters into equal groups for each rail. For example, if you are using 3 rails, you
    would break the secret message into 3 equal groups. Now you stack the groups on top of each other and read off the message vertically. If you get gibberish, then there are probably some extra letters tacked on the end of the message that are throwing off the
    grouping. Try removing one letter from the end and try again.
    So if the number of rails =3
    Plaintext :- "This is a sccerect message"
    Cipher Text:-"TSACTSGHISRMEISEEEAJ"
    Can we figure out to write a procedure or function for this.
    Rail Fence Encoder / Decoder
    Number of rails: <input class="form_txt_gr" maxlength="2" name="rails" size="3" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border:1px solid rgb(0, 0, 0);padding:2px 1px;margin:0px 5px 0px 2px;background-color:#ffffdd;"
    type="text" value="3" />
    Plaintext
    <textarea class="form_txt_gr" cols="40" name="message" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    Ciphertext
    <textarea class="form_txt_gr" cols="40" name="encoded" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    <input class="form_submit_gr" name="encipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;" type="submit"
    value="Encipher" /> <input class="form_submit_gr" name="decipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;"
    type="submit" value="Decipher" />
    Rail Fence Encoder / Decoder
    Number of rails: <input class="form_txt_gr" maxlength="2" name="rails" size="3" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border:1px solid rgb(0, 0, 0);padding:2px 1px;margin:0px 5px 0px 2px;background-color:#ffffdd;"
    type="text" value="3" />
    Plaintext
    <textarea class="form_txt_gr" cols="40" name="message" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    Ciphertext
    <textarea class="form_txt_gr" cols="40" name="encoded" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    <input class="form_submit_gr" name="encipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;" type="submit"
    value="Encipher" /> <input class="form_submit_gr" name="decipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;"
    type="submit" value="Decipher" />

Maybe you are looking for

  • Mini dvi to vga to projector help

    Having a serious issue with the mini dvi connector. It is plugged into the projector, everything is working fine. The mac is not able to discover the new display. It works fine on windows computers, but refuses to work on a mac. Is there anyway of ch

  • How to find combinations of a string

    Hi Dear, How can we find the combination of a given string whatever input given by user. If the String is A1C the possible outcomes are: A1C AC1 1CA 1AC CA1 C1A Best Regards, Aditya

  • Actions for making a video player

    May I ask if anyone knows of an action to create a cool looking video player? I have a product that includes a number of video tutorials and I want to be able to represent each tutorial with a cool looking video player with a thumbnail of the corresp

  • Sun Java System Messaging Server for Windows xp

    Hi, We are in a project that uses Sun Java System Messaging Server on Windows xp platform. But we didn't find the software download. Please tell how can i have that software?

  • Slight difference is coming while calculating Excise

    Hi In billing document , during the calculation of excise through basic value, SAP is calulating wrong value like Correct Value Basic Value -71730.45 ED - Value-10042.26 Ed Cess -200.85 SHE Cess - 100.42. System shows Basic Value - 71730.45 ED Value