This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
i have two different tables request and approval.
sno dat approved_by id hardware quantity approved_quantity
1 2013-04-06 A.S.C cm sssss3636 monitor 3 3
2 2013-04-06 A.S.C cm sssss3636 printer 4 4
3 2013-04-06 A.S.C it ddddd6086 monitor 3 3
4 2013-04-06 A.S.C it ddddd6086 printer 4 4
5 2013-04-06 A.S.C it ddddd6086 switch 2 2
sno fileno filesub hardware quantity department_name id rdate
1 hgdsh12 emnefkjhjems mouse 1 cm cmemnefkjhjems966 2001-01-01
2 ss111 hgfh mouse 1 cm cmhgfh695 2013-01-16
3 ss111 hgfh printer 2 cm cmhgfh695 2013-01-16
and i have a jtable in which i want to insert data.
i want department_name, rdate,fileno, filesub from request table and dat, quantity ,approved_quantity from approval using where clause..
give code for it..
any help will be appreciated..
select a.department_name,a.rdate,a.fileno,a.filesub,b.dat,b.quantity,b.approved_quantity from
request a inner join approval b on a.hardware=b.hardware and a.hardware='hardware given by user'
Joined: Apr 03, 2013
i used your query.but my code execute upto a point i mentioned below.
Class.forName("com.mysql.jdbc.Driver");//Connection establishment to the database
i have a jlist binded with database.. in database i stored multiple items in single id.. it is displaying it as every item with that id..
i selected from a jlist mouse, printer, ups and stored it with a unique id..
in database it is showing like this
hardware quantity id
mouse 1 it request8696
printer 2 it request8696
switch 34 it request8696
now i have bind this db table with another jlist which showing only id's..
i want it to show it request8696 to b shown only once.. but it is showing 3 times..
i have used netbeans bind elements to bind jlist..
thank you in advance..
I am not too sure about netbeans binding properties, but there must be a property there where you are specifying a table name. Just see if you can specify a sql query instead of table name, if this works, try a query with distinct clause.
eroor occur on execution...........
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [SELECT DISTINCTROW d FROM Request d ], line 1, column 35: multiple declaration of identification variable [d], previously declared as [DISTINCTROW d].