Want to select individual data as well as aggregate data from the same table

want to select a, b  from tab1  also need to find in the same table  tab1 need to do sum(b) group by a

SELECT a,b,0 AS Ord
FROM tab1
UNION ALL
SELECT a,SUM(b),1
FROM tab1
GROUP BY a
ORDER BY a,Ord
assuming SQL Compact
If its SQL Server then we have much simpler methods
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Retrieve data from the same table

    i have a table with following fields
    emp_no,name,salary,department,dept_prev,prev_emp_no.
    now i want retrieve emp_no,name,salary,department, from the data base for a perticular employeee number along with dept_prev
    but dept_prev is the prev_emp_no dept_prev
    now iam doing two query like this
    first query to retreive name,salary,department
    select name,salary,department from employee where emp_no = 10
    second to retrieve the dept_prev from the same table but this
    dept_prev must be based on prev_emp_no
    select dept_prev from employee where emp_no in(select prev_emp_no from employee where emp_no =10)
    can any one suggest to combine these two queries in a single sql statements, because all the fieldds are from the same table.
    Thanks

    Would this one solve it?
    SELECT emp.NAME, emp.salary, emp.department,
           prev_emp.dept_prev
      FROM employee emp,
           employee prev_emp
    WHERE emp.emp_no      = 10
       AND prev_emp.emp_no = emp.prev_emp_no;
    not tested
    C.

  • How to compare two fields from the same table in the select statement

    Hi, friends
    I try to compare tow fields from the same table, but no result,
    For example, this
    data: cptotchek tyep i.
    select count(*) into cptotchek
    from aufk where erdat = aufk-idat2 .
    The result is  cptotchek = 0, but there are the records in aufk , where,  aufk-erdat = aufk-idat2.
    Please, help me, i don't use the loop statement for optimize my program.
    Regards

    Hi  ,
           it will not return  any value   when you are using   column of same table 
           such as Date Field   , Because  while Using Aggregate Function  it will not check with self column
    .      For that you have to take data in one internal table and then you can work on it  .
         And if you are worried about Performance  it will not affect  , untill you are selecting only required data  .
    you can try this way  .
    data: cptotchek type i.
    types : begin of  w_aufk.
            include structure aufk  .
          types : end of  w_aufk .
    data : it_aufk type standard table of w_aufk with header line  .
    select * into corresponding fields of table it_aufk
    from aufk  .
    loop at it_aufk .
    if it_aufk-erdat  = it_aufk-idat2 .
    write : / it_aufk-erdat , it_aufk-idat2 .
    else .
    delete it_aufk .
    endif  .
    endloop.
    Regards
    Deepak.

  • How to read the hierarchy data from the same table using loop in AMDP method

    Hi All,
    We have a requirement to get the top partner from BUT050 table.
    Here the Top parent is nothing but the top most in the hierarchy of the partners from BUT050.
    Example:
    For partner 1234 (BUT050-PARTNER1) there is partner 3523(BUT050-PARTNER2) one level above
    For partner 3523(BUT050-PARTNER1)  there is partner 4544 (BUT050-PARTNER2) last level .
    so in this case for the partner 1234 the Top parent is 4544 .
    I have created AMDP Procedure method to get the top-parnet and below given is the logic implemented in AMDP method.
    Here i have implemented a recursive logic with the WHILE loop to get the top most hierarchy partner from the same table BUT050
    IV_Parent is the input partner and ev_top_parent is the output value.
    AMDP Procedure Method:
        DECLARE lv_date VARCHAR(8) := TO_VARCHAR (current_date, 'YYYYMMDD');
        DECLARE found INT := 1;
              iv_partner1 =  SELECT partner1 FROM but050
                              WHERE partner2 = iv_partner
                              AND reltyp = :iv_hierarchy
                              AND date_to >=  :lv_date
                              AND date_from <= :lv_date;
         WHILE found <> 0  do
           select partner1 into ev_top_parent from :iv_partner1;
                           iv_partner1 =  SELECT partner1 FROM but050
                           WHERE partner2 in ( select partner1 from :iv_partner1 where partner1 is not null)
                           AND reltyp = 'ZBP004'
                           AND date_to >= :lv_date
                           AND date_from <= :lv_date;
           select COUNT ( partner1 ) INTO found FROM :IV_PARTNER1;
        END WHILE;
    This method is working fine, but here it is only taking one single partner and getting the top parent as output.
    Now i would like to convert this mehtod so as to accept n number of partners (not one single partner) as input and should process each partner to get the top parent.
    Could anyone guide me how can i handle the given AMDP method further so as to work some how it is within another loop from other AMDP method.
    Thanks.
    Regards,
    Laxman.P

    Hi
    Go to SE11 and enter the hierarchy table name.
    /BIC/H....(infoobject name)...and execute the table and select table entry and delete all....
    Thanks
    TG

  • How to update a table (CUSTOMER) on a Report Server with the data from the same table (CUSTOMER) from another server Transaction server?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) From another server ex: Transaction server?
    Set up steps so inset, update or delete operation takes place across the servers.
    It would be great if someone please enlighten me in details about this process in MS SQL Server 2008 R2.
    Also please describe would it be different for SQL Server 2012?
    If so, then what are the steps?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) from another server ex: Transaction server?
    Set up steps so that inset, update or delete operation gets done correctly across servers.
    I was not sure about the answer, it would be great if someone please put some light on this and explain in details about this process in MS SQL Server 2008 R2.
    Also it would be very helpful if you please describe would it be different for SQL Server 2012? If so, then what are the steps?

  • I shoot RAW with my 7D Mark II.  PS is up-to-date.  Some of my photos from the same shoot will process but some say they can't be read.  What is going on?

    I shoot RAW with my 7D Mark II.  PS is up-to-date.  Some of my photos from the same shoot will process but some say they can't be read.  What is going on?

    Jim;
         All images are visible on my camera.  I am using fairly new 32GB CF and SDHC cards.  I will see if my card reader makes a difference.  I was going over photos I took in 2012 that I have reviewed before and some of them now aren't readable now.
         Thanks for the suggestions.
                   Alan
         www.newtonphotography.us
         [email protected]
         [email protected]
         B (231) 941-4307
         C (231) 342-0147
         611 West Ninth Street
         Traverse City, MI 49684 USA

  • Measure using UseRelationship not working well when sliced with attributes from the same table

    Hi,
    I have Measure created using the 'UseRelationship' Function, which uses a different datekey to link to the DateDim than the one the table is directly related by. The measure works as expected except in one scenario.
    If I browse the measure using an attribute from the same fact table then the attribute is filtered using active relationship whereas the measure is filtered using the inactive relationship as shown below:
    FACT(2 rows)(Active Relationship to Date using DateKey1)
    SNo     DateKey1     DateKey2     Geo        Amt
    1         20100101     20120101    India      100
    2         20100101     20120101    US         200
    AmtMeasure:=CALCULATE(SUM([Amt]),USERELATIONSHIP(FACT[DateKey2],'Date'[DateKey]))
    If I browse the above measure in excel, with Year selected as 2012, I get 100+200=300. Now if I drag the Geo attribute against the measure I get 2 rows with 100 and 200.
    If I do the same in a power view report I don't get any results after dragging the Geo attribute, whereas I get the correct value of 300 without the geo attribute. I checked the DAX query which the power view generates and figured this is being caused because
    there are no rows in the table with DateKey1 having year 2012. I understand why this is happening this way in a DAX query and not in MDX, but shouldn't both behave in the same way and what is a work around.
    Thanks,
    Sachin Thomas

    Sac, is this still an issue?
    Thank you!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How do I select rows from the same table that have multiple occurances

    Hi Everybody,
    I am trying to select records from a detail table by grouping it. The table has more than 1 million records and the query is not performing well. The basic question is how to select a distinct record from a table which matches all values in one column and any in the other.
    desc SCV
    ID NUMBER PK (ID + SCRID)
    SCRID NUMBER FK(SC)
    ID SCRID
    1 1
    2 1
    3 1
    4 2
    5 2
    6 3
    7 4
    8 4
    desc PROJECTS
    ID NUMBER PK
    NAME VARCHAR2(100)
    ID NAME
    1 PROJECT1
    2 PROJECT2
    3 PROJECT3
    4 PROJECT4
    desc PJS
    ID NUMBER
    PROID NUMBER FK (PROJECTS)
    SCRID NUMBER FK (SCV(SCRID + SCVID)
    SCVID NUMBER
    ID PROID SCRID SCVID
    1 1 1 1
    2 1 1 2
    3 1 2 5
    4 1 3 6
    5 1 4 7
    6 2 1 3
    7 2 2 4
    8 2 2 5
    9 2 4 7
    There are over 1 million records in PJS.
    desc TBP
    SCRID NUMBER
    SCVID NUMBER
    SCRID SCVID
    1 1
    1 2
    1 3
    2 4
    2 5
    3 6
    4 7
    4 8
    The requirement is to select projects that have matching SCRID, SCVID from TBP such that
    all distinct SCRID should match and within that and any SCVID match will do. (A "AND" between each SCRID and an "OR" for each SCVID in that SCRID like 'SCRID = 1 AND (SCVID = 1 OR SCVID = 2 OR SCVID = 3) AND SCRID = 2 AND (SCVID =....)
    So, for the sample data it should return us PROID = 1
    I have few queries written for this:
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 1
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 2
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 3
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 4
    This query performs well but the cost is very high, hardcoding, sorting.
    The 2nd option is to:
    SELECT pjs.PROID proid
    FROM TBP tbp,
    PJS pjs
    WHERE pjs.SCVID = tbp.SCVID
    AND pjs.SCRID = tbp.SCRID
    GROUP BY pjs.PROID
    HAVING COUNT(DISTINCT pjs.SCRID) = (SELECT COUNT(DISTINCT SCRID ) FROM TBP)
    This has a low cost but runs slowly.
    One more way I tried was with the IN operator like
    SELECT DISTINCT PROID FROM PJS A,TBP T WHERE T.SCRID = 1 AND T.SCVID = A.SCVID
    AND PROID IN (SELECT PROID FROM PJS A,TBP T WHERE T.SCRID = 2 AND T.SCVID = A.SCVID
    AND PROID IN (...SO ON with each DISTINCT SCRID.
    Again this involves too much of sorting.
    Any help will be appriciated.
    Thanks in advance.

    Hi Andrew,
    Use DELETE t_itab statement inside the loop.
    I have modified your code. It is perfectly working.See bellow  -
    LOOP AT it_zmember01 INTO wa_zmember01.
    WRITE: / wa_zmember01-mnumber UNDER 'NUMBER',
    wa_zmember01-mname UNDER 'NAME',
    wa_zmember01-mdob UNDER 'DOB'.
    WRITE / '-----------------------------------------------------------------'.
    DELETE it_zmember01.               " Modified
    ENDLOOP.
    DELETE it_zmember01. statement inside the loop will delete the current row of the table.
    Regards
    Pinaki

  • Query - Get data from the same table and field two times on a single line

    I have prepared a query showing the bill of material. At each line each component will be a new line and I want to have the description of the material at the top (the master material composed of the component ones) and also the description of the component materials on the same line. This means that I should be able to use MAKT table 2 times on a single line of the query. I have used the query tool with SQ01 and SQ02 tcodes. How can I get the the description of the material at the top and also the description of the component material on a single line?
    Thanks in advance for the answers.

    Yasar,
    Any time you wish to use a table twice in an SQ01 query, you have to create an alias.
    SQ02 > select the infoset, 'change' > go to Join definitions.
    Select 'Alias' button.  Create. Select your table name (such as MAKT) and define an alias, such as 'COMP_MAKT' for component descriptions.
    Now you can insert the Alias table into your infoset just like it was a regular table, and use standard join method to join COMP_MAKT to your component material number.
    Best regards,
    DB49

  • Update multiple rows with datas from the same table

    i have a table like
    name version value1 value2
    2 A 4,31 3,5
    3 A 3,45 10
    2 B 6,97 12
    4 B 12 16
    so name + version is unique
    i have to update the datas value1 and value2 ( version A) with the datas from version B where the name ( VersionA) = name version B
    i.e the result should be
    name version value1 value2
    2 A 6,97 12
    3 A 3,45 10
    2 B 6,97 12
    4 B 12 16
    is it possible to do this in sql? ( sql. 8.1)

    ... if your table does not contain exactly what you expect you could get:
    'single row sub-query returns more than one row'
    To prevent that, put a unique index on (name, version). If this combination is not always unique, you will need to cater for the possibility in the update statement.

  • Update and Select from the same table

    Hello,
    i have this select - i tested it and its working
    [code]
    select
    case
    when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTBT
    else DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
    end
    as KTBT_ISO,
    case
    when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTZN
    else DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
    end
    as KTZN_ISO,
    case
    when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTAB
    else DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB
    end as KTAB_ISO,
    DTF_REEW_201301.brnrn,
    DTF_REEW_201301.ktat
       from
    reewcore.CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq.DTF_REEW_201301 DTF_REEW_201301
       where
    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1)
    [/code]
    With the result from KTBT_ISO, KTZN_ISO and KTAB_ISO i want to update the table "reewdq.DTF_REEW_201301" - and this table is in the select-statement!
    I believe, i tried every update-statement - but no update is working.
    I need something like this:
    [code]
    update reewdq.DTF_REEW_201301 t1 set t1.KTBT_ISO=
    select
    case
    when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTBT
    else DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
    end
    as KTBT_ISO
       from
    reewcore.CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq.DTF_REEW_201301 DTF_REEW_201301
       where
    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1)
    t1.KTZN_ISO=
    select
    case
    when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTZN
    else DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
    end
    as KTZN_ISO
       from
    reewcore.CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq.DTF_REEW_201301 DTF_REEW_201301
       where
    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1)
    t1.KTAB_ISO=
    select
    case
    when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTAB
    else DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB
    end as KTAB_ISO
       from
    reewcore.CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq.DTF_REEW_201301 DTF_REEW_201301
       where
    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1)
    [/code]
    But this code isn´t working. Has someone an idea please? Can someone please help me.
    Best regards
    Heidi

    Use MERGE:
    merge
      into reewdq.DTF_REEW_201301 t1
      using (
             select  case
                       when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTBT 
                       else DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
                     end as KTBT_ISO,
                     case
                       when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTZN 
                       else DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
                     end as KTZN_ISO,
                     case
                       when DTF_REEW_201301.KTMO =1 then DTF_REEW_201301.KTAB 
                       else DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB
                     end as KTAB_ISO,
                     reewdq.ROWID as rid
               from  reewcore.CTF_REEW_KUM_201301 CTF_REEW_KUM_201301, 
                     reewdq.DTF_REEW_201301 DTF_REEW_201301
               where DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
                 and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT
                 and CTF_REEW_KUM_201301.KTMO = DTF_REEW_201301.KTMO - 1
            ) t2
      on (
          t1.rowid = t2.rid
      when mathed
        then
          update
             set t1.KTBT_ISO = t2.KTBT_ISO,
                 t1.KTZN_ISO = t2.KTZN_ISO,
                 t1.KTAB_ISO = t2.KTAB_ISO
    SY.

  • I purchased Mountain Lion on my MacBook and want it on my mac desktop as well. Can I download the same purchase on my desktopMac? and how do i do that?

    I purchased Mountain Lion on my MacBook and want it on my mac desktop as well. Can I download the same purchase on my desktopMac? and how do i do that?

    Welcome to the Apple Support Communities
    When you purchase Mountain Lion, you can install it as many times as you want on all your computers for free. To install it on the desktop, open the App Store, go to Purchases tab and download OS X Mountain Lion.
    Another option is to redownload it on the MacBook, put the installer onto a USB drive and connect it to the desktop in order to upgrade

  • How to return multipart HTTP response containing image data as well as xml data

    Hi,
    My web service accepts
    request as string and returns response as string. Being new to ASP.Net, please clarify my below doubts.
    a)  How
    can i provide multipart response of the below format while returning response in string format.. How to implement multi-part response where I need to return Image data as well as xml data also.
    HTTP/1.0 200 OK
    Date: Wed, 03 Mar 2004 14:45:11 GMT
    Server: xxx
    Connection: close
    Content-Type: application/xxx-multipart
    Content-Length: 6851
    Content-Type: image/jpeg
    Content-Length: 5123
    CommandID: asset14521
    <5123 bytes of jpeg data>
    Content-Type: xxx-xml
    Content-Length: 1523
    <?xml...
    Thanks,
    Divya

    Hi MeetDivya,
    I suggestion you post the question in the ASP.NET forums at
    http://forums.asp.net/. It is appropriate and more experts will assist you.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I recently got the iPhone 4s, but my iPod has a lot of apps with a lot of data on them and don't want to start over. I already synced my iPhone from the computer that had all my apps from my iPod, how do i transfer the data over, the other apps did.

    I recently got the iPhone 4s, but my iPod has a lot of apps with a lot of data on them and don't want to start over. I already synced my iPhone from the computer that had all my apps from my iPod, how do i transfer the data over, the other apps did. But some reason the app Clash Of Clans did not. Thank you.

    If I wiped my phone I wouldn't have the contacts on my phone to send to my self.    I would need to take just the contacts from my back up. I would have to do this through iTunes and I don't see how I can just extract the contacts only from my back up. From what I can figure out it is all or nothing

  • Upload image to directory and data to database from the same form

    Hello all
    I'm playing at building a shopping cart (never done one
    before) from a tutorial by Gordon Knapp at www.webthang.com.
    I have created the site and it works perfectly. Now I want to
    extend it.
    There is a form that allows the user to add data to the
    database. I would also like to be able to upload an image to a
    directory on the server and add the data to the database at the
    same time from the same form. It would be good if the input field
    "<input name="product_picture" type="text" id="product_picture"
    tabindex="6" size="50" />" could be populated automatically by
    the filename of the image being uploaded, but this isn't a
    neccessity.
    I have looked at various ASP Upload packages and I can upload
    an image alone but none of them make it clear how to upload the
    image and add data to the database at the same time.
    As this is a private project I need any suggestions to by
    free.
    The tutorial shows how to create the site in Ultra Dev but
    worked perfectly well in DW. The page concerned looks like this. It
    is named 'admin_add.asp':
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!--#include file="../Connections/con_ecom.asp" -->
    <%
    Dim MM_editAction
    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" &
    Server.HTMLEncode(Request.QueryString)
    End If
    ' boolean to abort record edit
    Dim MM_abortEdit
    MM_abortEdit = false
    %>
    <%
    ' IIf implementation
    Function MM_IIf(condition, ifTrue, ifFalse)
    If condition = "" Then
    MM_IIf = ifFalse
    Else
    MM_IIf = ifTrue
    End If
    End Function
    %>
    <%
    If (CStr(Request("MM_insert")) = "add_form") Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_con_ecom_STRING
    MM_editCmd.CommandText = "INSERT INTO products
    (product_category, product_name, product_price, product_briefdesc,
    product_fulldesc, product_picture) VALUES (?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202, 1, 50,
    Request.Form("product_category")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202, 1, 50,
    Request.Form("product_name")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 5, 1, -1,
    MM_IIF(Request.Form("product_price"),
    Request.Form("product_price"), null)) ' adDouble
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 203, 1, 536870910,
    Request.Form("product_briefdesc")) ' adLongVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 203, 1, 536870910,
    Request.Form("product_fulldesc")) ' adLongVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 202, 1, 50,
    Request.Form("product_picture")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "admin_control.asp"
    If (Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
    Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" &
    Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" &
    Request.QueryString
    End If
    End If
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Administration - Add Product</title>
    <link href="../scripts/admin.css" rel="stylesheet"
    type="text/css" />
    <script type="text/javascript"
    src="../scripts/ecom.js"></script>
    </head>
    <body onLoad="adminTitle()">
    <div id="wrapper">
    <div id="pageHeading">ADMINISTRATION - ADD
    PRODUCT</div>
    <div id="navBar"><a
    href="admin_control.asp">Control</a> | Add | <a
    href="admin_view.asp">View</a> | <a
    href="admin_update1.asp">Update</a> | <a
    href="admin_delete1.asp">Delete</a> | <a
    href="../Default.asp">Shop</a></div>
    <br />
    <form name="add_form" id="add_form" method="POST"
    action="<%=MM_editAction%>">
    <table border="1" align="center" id="tblArea">
    <tr>
    <td class="tdLabel">Product Category</td>
    <td colspan="2"><input name="product_category"
    type="text" id="product_category" tabindex="1" size="50"
    /></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Name</td>
    <td colspan="2"><input name="product_name"
    type="text" id="product_name" tabindex="2" size="50"
    /></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Price</td>
    <td class="tdContent" colspan="2"><input
    type="text" name="product_price" id="product_price" tabindex="3"
    size="50" /></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Short
    Desciption</td>
    <td class="tdContent" colspan="2"><textarea
    name="product_briefdesc" id="product_briefdesc" cols="47" rows="4"
    tabindex="4"></textarea></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Full
    Description</td>
    <td class="tdContent" colspan="2"><textarea
    name="product_fulldesc" id="product_fulldesc" cols="47" rows="5"
    tabindex="5"></textarea></td>
    </tr>
    <tr>
    <td class="tdLabel">Product Image File Name</td>
    <td class="tdContent" colspan="2"><input
    name="product_picture" type="text" id="product_picture"
    tabindex="6" size="50" /></td>
    </tr>
    <tr>
    <td class="tdLabel"> </td>
    <td align="center"><input type="reset" name="Reset"
    id="Reset" value="Reset Form" /></td>
    <td align="center"><input type="submit"
    name="Submit" id="Submit" value="Add To Shop" /></td>
    </tr>
    </table>
    <input type="hidden" name="MM_insert" value="add_form"
    />
    </form>
    </div>
    </body>
    </html>
    Hope you can help.
    Warm regards
    Martin

    Got it sorted.
    Found an excellent tutorial at Webthang.
    http://www.webthang.co.uk/tuts/tuts_dmx/rob15/rob15.asp

Maybe you are looking for