List out on the one row with all variables from db

from DB
namn
namnID namn
166 -----------------------
167 pierre lemon
170 Lena Jakobsson
171 adas
172 Lena M Jakobsson
175 Per Olofsson
Inmata
id namnID startdate slutdate vc fargkod
50 167 2006-04-20 2006-04-27 Uddevalla Re
54 167 2006-05-20 2006-07-20 Vänersborg A
58 167 2006-08-21 2006-09-01 Uddevalla O
61 170 2006-04-24 2006-05-03 ----- P
<cfquery name="row_stsl" datasource="at">
SELECT DISTINCT count(namnID) as sum_namnID
FROM inmata
group by namnID
</cfquery>
<cfset sum_namnIDa = row_stsl.sum_namnID>
<cfoutput query="row_stsl">
<table border="1">
<tr><td>#sum_namnID#</td></tr>
</cfoutput>
<cfscript>
for (i=1; i lt sum_namnIDa; i=i+1)
writeoutput ( "<td>" & startdate & slutdate
& "</td>");
</cfscript>
<cfoutput>
</table>
</cfoutput>
My idea is to count number of nameID and build one row using
<td> within startdate and slutdate </td>
if there is 3 namnID so create three startdate and slutdate
but don't know exact how to code.
Any suggestion?
I tried to get out startdate and slutdate in ordinal on the
one row.
Name:
eg.
Pierre Lemon 1. 2006-04-24 2006-06-02 2. 2006-06-03
2006-07-25 3. etc startdate and slutdate on the row.

<cfquery name="row_stsl" datasource="at">
SELECT Count(inmata.namnID) AS sum_namnID,
First(inmata.startdate) AS Förstaförstartdate,
Last(inmata.slutdate) AS Sistaförslutdate
FROM inmata
WHERE ((inmata.startdate) AND (inmata.slutdate))
GROUP BY inmata.namnID;
</cfquery>
<cfloop query="row_stsl">
<table border="1">
<tr>
<cfscript>
for (i=1; i lte sum_namnID; i=i+1)
writeoutput ("<td>" & #dateformat
(Förstaförstartdate,"yyyy-mm-dd")# & " "
& #dateformat (Sistaförslutdate,"yyyy-mm-dd")# &
"</td>");
</cfscript>
</tr>
</table>
</cfloop>
Resultat:
2006-04-20 2006-09-01 2006-04-20 2006-09-01 2006-04-20
2006-09-01
2006-04-24 2006-05-03
In DB
id namnID startdate slutdate
50 167 2006-04-20 2006-04-27
54 167 2006-05-20 2006-07-20
58 167 2006-08-21 2006-09-01
61 170 2006-04-24 2006-05-03
yes, startdate and slutdate is date as datatype
Is it SQL statement or cfscript I will change on?
Have tried with other sql question but it will not take
effect to get out answer.
SELECT inmata.namnID, Count(inmata.namnID) AS Antal,
inmata.startdate AS start_datum, inmata.slutdate AS slut_datum
FROM inmata
GROUP BY inmata.namnID, inmata.startdate, inmata.slutdate
HAVING (((inmata.startdate) Is Not Null) AND
((inmata.slutdate) Is Not Null));
Because the result is :
2006-04-20 2006-05-03
2006-04-20 2006-04-27
2006-05-20 2006-07-20
2006-08-21 2006-09-01
2006-04-24 2006-05-03
2006-04-20 2006-04-27
2006-08-21 2007-05-03
Any idea?!

Similar Messages

  • I have an iPod nano 2nd generation and I want to download the songs I have on it to my new computer, as my old one crashed with all the songs on it.  I also got a new iPod and would like to transfer the old songs onto it. How do I do this?

    I have an iPod nano 2nd generation and I want to download the songs I have on it to my new computer, as my old one crashed with all the songs on it.  I also got a new iPod and would like to transfer the old songs onto it. How do I do this?

    Ok so sorry for clogging the community!! I figured it out - you have to copy your videos into itunes manually. I did that, synched and all good!

  • Exporting PDF document to Excel.  When I export a PDF document to Excel containing lists of  people the Excel page shows all the names on  one line several inches deep instead of on separate lines which makes editing impossible.  What am I doing wrong?

    Exporting PDF document to Excel.  When I export a PDF document to Excel containing lists of  people the Excel page shows all the names on  one line several inches deep instead of on separate lines which makes editing impossible.  What am I doing wrong?

    Murray is right. Padding (and margins) is added to the width. However, when using percentages, you should never use figures that add up to exactly 100%.
    Browsers need to convert the percentages to pixels. Because pixels must be whole numbers, some percentages are rounded up, which results in the final element dropping down below its neighbours. With percentages, it's much safer to use values that add up to 98% (99% often works, but 98% is safer).

  • Condition that takes only one row with the maximum cost of the maximum date

    I have to the following query
    SELECT distinct b.segment1 ||'.'|| b.segment2 as ITEM,
           so.vendor_site_id as SUPPLIER,
           'VE' as ORIGIN_COUNTRY_ID,
           replace(round(l.mto_costo_neto/l.can_unidades_empaque,2),',','.') as UNIT_COST,
           5 as lead_time,
           null as pickup_lead_time,
           l.can_unidades_empaque as supp_pack_size,
           1 as inner_pack_size,
           'C' as round_lvl,
           50 as ROUND_TO_INNER_PCT,
           50 as ROUND_TO_CASE_PCT,
           50 as ROUND_TO_LAYER_PCT,
           50 as ROUND_TO_PALLET_PCT,
           null as MIN_ORDER_QTY,
           null as MAX_ORDER_QTY,
           'FLAT' as PACKING_METHOD,
           'N' as PRIMARY_SUPP_IND,
           'Y' as PRIMARY_COUNTRY_IND,
           case when b.primary_unit_of_measure like '%KG%' then 'KG'
                when b.primary_unit_of_measure like '%Kg%' then 'KG'
                when b.primary_unit_of_measure like '%UND%' then 'EA'
                when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                when b.primary_unit_of_measure = 'Litro' then 'L'
                when b.primary_unit_of_measure = 'Unidad' then 'EA'
                else null
           end as DEFAULT_UOP,
           1 as TI,
           1 as HI,
           null as SUPP_HIER_TYPE_1,
           null as SUPP_HIER_LVL_1,
           null as SUPP_HIER_TYPE_2,
           null as SUPP_HIER_LVL_2,
           null as SUPP_HIER_TYPE_3,
           null as SUPP_HIER_LVL_3,
           null as CREATE_DATETIME,
           null as LAST_UPDATE_DATETIME,
           null as LAST_UPDATE_ID,
           case when b.primary_unit_of_measure like '%KG%' then 'KG'
                when b.primary_unit_of_measure like '%Kg%' then 'KG'
                when b.primary_unit_of_measure like '%UND%' then 'EA'
                when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                when b.primary_unit_of_measure = 'Litro' then 'L'
                when b.primary_unit_of_measure = 'Unidad' then 'EA'
                else null
           end as COST_UOM,
           null as TOLERANCE_TYPE,
           null as MAX_TOLERANCE,
           null as MIN_TOLERANCE
    FROM mrp.mrp_sr_assignments sr , MRP.MRP_SR_RECEIPT_ORG ro , MRP.MRP_SR_SOURCE_ORG so,
         inv.mtl_system_items_b b, lcm.cmp_lineas_cotizacion l
    WHERE sr.SOURCING_RULE_ID = ro.SOURCING_RULE_ID
          and ro.SR_RECEIPT_ID = so.SR_RECEIPT_ID
          and sr.inventory_item_id in ((select inventory_item_id  from TMP.VIVERES_VEGETALES)
                                      UNION ALL
                                      (select inventory_item_id  from TMP.GENERICOS)
                                      UNION ALL
                                      (select inventory_item_id from TMP.HIJOS_GENERICOS))
          and sr.inventory_item_id = b.inventory_item_id
          and b.organization_id = 136
          and sr.inventory_item_id = l.cod_producto_idI need to agregate the following condition
    For example, The following query
    SELECT l2.fec_ini_vigencia_costo, l2.mto_costo_neto, l2.can_unidades_empaque, l2.cod_producto,
           REPLACE(ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2),',','.')  costo_unidad
    from cmp_lineas_cotizacion l2
    order by cod_producto, fec_ini_vigencia_costo desc, mto_costo_neto descgenerate
    FEC_INI_VIGENCIA_COSTO     MTO_COSTO_NETO     CAN_UNIDADES_EMPAQUE     COD_PRODUCTO      COSTO_UNIDAD
    17/06/2010     382.56     12     1.1000008     31.88 -- THIS ONE
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    23/03/2009     373.2072     12     1.1000008     31.1
    23/03/2009     373.2072     12     1.1000008     31.1I need to take only one row with the maximum FEC_INI_VIGENCIA with the maximum COSTO_UNIDAD of the table lcm.cmp_lineas_cotizacion l, which is calculated with the formula ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2)

    A better example
    I need only one row the maximum COSTO_UNIDAD for the maximum FEC_INI_VIGENCIA for every cod_producto_id in the table lcm.cmp_lineas_cotizacion
    I need to take these values
    FEC_INI_VIGENCIA_COSTO     MTO_COSTO_NETO     CAN_UNIDADES_EMPAQUE     COD_PRODUCTO_ID  COSTO_UNIDAD
    17/06/2010     382.56     12     1.1000008     31.88 -- THIS!
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    27/10/2010     1171.549344     12     1.1000009     97.63 -- THIS!
    13/10/2010     1171.549344     12     1.1000009     97.63
    06/09/2010     1171.549344     12     1.1000009     97.63
    02/08/2010     1048.825056     12     1.1000009     87.4
    28/07/2010     754.8     12     1.1000009     62.9
    27/07/2010     614.04     12     1.1000009     51.17
    21/06/2010     954.84     12     1.1000009     79.57
    27/05/2010     614.04     12     1.1000009     51.17
    07/07/2009     1143.17     12     1.1000010     95.26
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84
    07/07/2009     1143.17     12     1.1000010     95.26             --THIS!
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84
    07/07/2009     1143.17     12     1.1000010     95.26
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84

  • How can I view the complete score with all tracks? I seem to only be able to view one track at a time. Thanks

    How can I view the complete score with all tracks? I seem to only be able to view one track at a time. Thanks

    JoBrooke wrote:
    I seem to only be able to view one track at a time.
    unfortunately, that is how GB works, it only offers a score for a single track at a time

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • How to delete the selected rows with a condition in alv

    dear all,
    i am using the code in object oriented alv.
    WHEN 'DEL'.
    PERFORM delete_rows.
    FORM delete_rows.
    DATA : lv_rows LIKE lvc_s_row.
    data : wa_ROWs like LVC_S_ROW.
    FREE : gt_rows.
    CALL METHOD alv_grid->get_selected_rows
    IMPORTING
    et_index_rows = gt_rows.
    IF gt_rows[] IS INITIAL.
    MESSAGE s000 WITH text-046.
    EXIT.
    ENDIF.
    loop at gt_rows into wa_ROWs .
    if sy-tabix ne 1.
    wa_ROWs-INDEX = wa_ROWs-INDEX - ( sy-tabix - 1 ).
    endif.
    delete gt_sim INDEX wa_ROWs-INDEX .
    endloop.
    the rows to be deleted from int.tab gt_sim not in the alv display.
    all the rows should not be deleted if one of the field in gt_sim eq 'R'.
    how to check this condition

    dear jayanthi,
            ok if i am coding like that as u mentioned ,
              it will exit the loop when first time the field value is 'R'.
      if any of  the selected rows contains  field value 'R'. it shold not delete all the selected rows.
    as u suggested it will not delete after first time the field value is r.
    i am deleting it by tab index so,
    suppose if i am selecting the row without field value R say its tabix is 1.
      the next row with tabix 2 with field value R.
      it deletes the first row and exits , it should not delete the first row also.

  • HT1338 why is my MacBook Air running slow and I bought the 11 inch with all memory and turbo boost

    why is my MacBook Air running slow and I bought the 11 inch with all memory and turbo boost

    Please answer as many of the following questions as you can. You may already have answered some of them. In that case, there's no need to repeat the answers.
    Have you restarted your router and your broadband device (if they're separate) since you first noticed the problem? If not, do that now and see whether there's any change.
    If your browser is Safari, then from the Safari menu bar, select
    Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    and confirm. Any change?
    Quit and relaunch the browser. Any change?
    Log out and log back in. Any change?
    Enable Private Browsing in the Safari menu. Any change?
    Are any other web browsers installed, and are they the same? What about other Internet applications, such as iTunes and the App Store?
    If other browsers and Internet applications are also affected, follow these instructions and test. Any change?
    If only Safari is affected, launch the Activity Monitor application and enter "web" (without the quotes) in the search box. If a process named "Safari Web Content" is shown in red or is using more than about 5% of a CPU, select it and force it to quit by clicking the X or Quit Process button in the toolbar of the window. There may be more than one such process. Any improvement?
    Again, if only Safari is involved, open the iCloud preference pane and uncheck the box marked Safari, if it's checked. Any change?
    Are there any other devices on the same network that can browse the Web, and are they affected?
    If you can test Safari on another network, is it the same there?
    If you connect to your router with Wi-Fi and you can also connect with Ethernet, do that and turn off Wi-Fi. Any difference?

  • I'm trying to change my ICloud e-mail to match the one associated with the Apple ID? Can someone tell me how to do this? Seems like the phone won't accept the new one, the message states "you already have acct associated....."  (a given!!)  I need help !!

    I'm trying to change my ICloud e-mail to match the one associated with the Apple ID? Can someone tell me how to do this? Seems like the phone won't accept the new one, the message states "you already have acct associated....."  (a given!!)  I need help !!

    You made a purchase and exhausted the credit on your card before it processed. All purchases are final. Contact iTunes Store support. You need to settle up before you can purchase or download anything else.

  • How do I share the iTunes library with all/some of the other users on the same iMac?

    How do I share the iTunes library with all/some of the other users on the same iMac?

    Check out these articles it may help...
    http://support.apple.com/kb/HT3819
    http://www.apple.com/itunes/how-to/#playlists-shareplaylists
    hope this helps.

  • I've lost the cd-rom with all the drivers!

    I've lost the cd-rom with all the drivers, and I've formated my harddrive! How do I get a new one? Can I download a .bin somewhere? I can't do anything now! I'm on my 2:nd computer writing this.
    It's the mobo drivers I need(MSI K8N Neo2 nForce3 Platinum).

    Quote from: pipe_ on 03-August-05, 23:44:37
    I've lost the cd-rom with all the drivers, and I've formated my harddrive! How do I get a new one? Can I download a .bin somewhere? I can't do anything now! I'm on my 2:nd computer writing this.
    It's the mobo drivers I need(MSI K8N Neo2 nForce3 Platinum).
    DOWNLOAD DIRECT FROM MSI HERE
    Best to make sure it the right model you can try HERE
    Down load, copy to disk, install from disk when ready. e g after windows install (you will still need the windows disk and your CD key)

  • My tabs are seperated into groups. Once I accidentaly opened a site in a new window (not a new tab). After that, I accidentaly closed the Firefox window with all my grouped tabs. Now, I can't recover it. Are there any solutions?

    I have my tabs seperated into several groups (for example, bank tabs, music tabs, social life tabs and so on). I do this with the help of the button in the top left corner. While I was surfing the internet, I accidentaly opened a site not in a new tab (as I usually do), but in a new window. The new window was without all the grouped tabs, which I had in the previous Firefox window. And then I accidentaly closed the Firefox window with all my grouped tabs. Now I can't recover it. Are there any solutions?

    Hi,
    We have rolled out a fix for this issue.
    Please log off and log back in to your machine and the issue should be resolved automatically. In case that does not work, please manually run the msi installer posted here (may require reboot).
    For details, please refer to the KB article here: Multiple RunOnce keys created 11.0.10 and 10.1.13 Acrobat | Reader
    Please let us know if you still face any issues.
    Thanks,
    Ashu Mittal

  • How can I replace the out of the box photos with my own when music is playing?

    How can I replace the out of the box photos with my own when music is playing?

    Welcome to the Apple Community.
    Select any photos you want to share with the Apple TV using the iTunes advanced menu (using iPhoto is the better option but a folder will work). Once all the photos you want are shared, go to settings > screensaver on the Apple TV and choose which of those shared photos you want to use with your screensaver.

  • How to retrieve all the users along with their password from LDAP

    Hello,
    Can anyone let me know how to retrieve and list all the user along with their password from LDAP.
    Thanks

    Hi Prashant,
    I have limited experience with Synchronization, but I agree with you - if you need to synchronize Passwords, you need to have the Password in clear Text.
    If you trying to build your own Synchronization Solution using any of the avaliable LDAP APIs, I don't think you can ever retrieve a user's Password in clear text.
    However, I did come across an interesting article & I hope you find it useful :-
    http://www.oracle.com/technology/obe/obe_as_10g/im/configssl/configssl.htm
    I am not sure if SSL is necessary - If you have a look at Metalink Note 277382.1 ( How to Configure OID External Authentication Plug-In for Authentication Via Microsoft Active Directory (MS AD) ), teh question asked by oidspadi.sh for the same is asnwered as "N".
    Regards,
    Sandeep

  • Help I just installed the latest update on my IPhone4 and now I can't open any of my stored podcasts. When I hit the podcast icon, the screen goes white for a second and the goes back to the opening page with all the icons. What happened?

    Help! I just installed the latest update on my IPhone 4 and now I can't access my podcasts. When I hit the podcast I on, the screen goes blank for a second and then opens to the home screen with all my icons. What happened?

    Try a reset which is similar to a computer restart and is done by pressing and holding the home button and the sleep/wake or on/off button simultaneously you see the Apple logo and then release.

Maybe you are looking for

  • Impact of data file size on DB performance

    Hi, I have a general query regarding size of data files. Considering DB performance, which of the below 2 options are better? 1. Bigger data file size but less number of files (ex. 2 files with size 8G each) 2. Smaller data file size but more number

  • How to Access the Remote Servlet through a JSP Page

    Hi , I wrote a servlet in my local system and It is running very well in my tomcat server5.5. Now I write a JSP code an another one system. Now I don't know how to call my servlet when Click a submit button. I need a small example or idea about this.

  • Suggesion required in schedulin sender adapter using availability time plan

    Hi Experts, I have to schedule sender JDBC adapter as per below business requirement: Every month i have to exclude first 5 days and remaining days adapter has to run till month end. I have selected monthly frequency in Availability time plan and pro

  • 6120 - no connections listed, how to restore or ad...

    In Nokia Connection Manager on my computer (Nokia PC Suite > Settings > Manage connections), it says "activate a connection type by selecting a check box.  You can edit the highlighted connection by clicking the Configure button." There are no connec

  • Using mxmlc to compile AS files

    Hi there, I'm wondering if there's a way to compile all classes into 1 swf file? As it is, I have a command that does "mxml -includes classA classB -output classC.swf classC" and although I have classC.swf, when I load it on my webpage, it makes two