I have displayed two tables on web(i.e table1 and table2) using 
*connection.cursor* from *SOURCE* table

  *ISSUE:*

  Now I have to subtract table1(fields)-table2(fields) and display the 
output as table3.


   so *final web page* will have table1,table2,table3


  *PROGRAM:*


  IN *views.py*


*  #table 1*

  cursor1=connection.cursor()

    cursor1.execute('''select dummy as LCR_CUSTOMER_TYPE,CUR AS CURRENCY,

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_NONOP_INS))) as 
LCR_NONOP_INS, 

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_OP_INS))) as LCR_OP_INS, 

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_NONOP_UNINS))) as 
LCR_NONOP_UNINS, 

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_OP_UNINS))) as LCR_OP_UNINS

from (select *,(case when LCR_CUSTOMER_TYPE='Corporate' then 'Non-Credit 
Financial Entities'

else LCR_CUSTOMER_TYPE

end) as dummy from   DDA_BASED_S9_20150930) a

group by CUR,dummy

''')

    list=cursor1.fetchall();

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      *#table 2*

    cursor = connection.cursor()

    cursor.execute('''select AFTERMEMO,CUR AS CURRENCY,

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_NONOP_INS))) as 
LCR_NONOP_INS, 

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_OP_INS))) as LCR_OP_INS, 

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_NONOP_UNINS))) as 
LCR_NONOP_UNINS, 

'$'+CONVERT(VARCHAR(20), CONVERT(MONEY, sum(LCR_OP_UNINS))) as LCR_OP_UNINS

from (select *,(case when SIC_CODE = 7215 and 

LCR_CUSTOMER_TYPE = 'Non-Credit Financial Entities' then 'NonFinancialCorp' 

when LCR_CUSTOMER_TYPE = 'Corporate' then 'Non-Credit Financial Entities'

else LCR_CUSTOMER_TYPE end) as AFTERMEMO from  DDA_BASED_S9_20150930) a

group by  CUR,AFTERMEMO

''')

list1=cursor.fetchall();


*TABLE3=TABLE1-TABLE2*


can anyone tell me how to do this...it will be very helpful

  *thanks in advance*


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d325343-5f68-49e5-a918-a3b51da08acb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to