473,471 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sql query in ireport

31 New Member
I am using a sql query in ireport to make a report based on two tables.I have 2 tables ORDER and ORDER_LINE.Orders contains orders of seeds ordered by different requesters.

ORDER:Order_ID,Seed_ID,quantity(here orderid and seedid are composite primary key and one order may contain requests of multiple seeds by the same requester)
ORDER_LINE:Order_ID,Req_ID,Date of order,no.of seeds

Now i have to show all this information on a single report.
I am using ireport and i m new to this tool.The query i have made is like this:
Expand|Select|Wrap|Line Numbers
  1. Select orders.Order_ID AS "Order_ID",orders.quantity AS "quantity",orders.Seed_ID AS "Seed_ID",order_line.R_ID AS "R_ID",order_line.Date_order AS "date",order_line.no_of_seeds AS "no. of seeds",requesters.R_NAME AS "Req" from orders,order_line,requesters where orders.Order_ID=order_line.Order_ID AND order_line.R_ID=requesters.R_ID;
  2.  
The query is working but i want to display the Seed_ID's 0f one order separated by comma .I have use group_concat() but it shows then only one order and displays all the seed id's form the table in one row separated by comma.I need help for this query.I think my query for group_concat is not right.
Jun 22 '12 #1

✓ answered by Luuk

The query is working but i want to display the Seed_ID's 0f one order separated by comma
You can only do this if you use 'GROUP BY Order_ID'

But how will you show 'quantity' for this seeds?
Should it show the total quantity?

BTW, if you format your query its more readible:
Expand|Select|Wrap|Line Numbers
  1. Select 
  2.     orders.Order_ID AS "Order_ID",
  3.     orders.quantity AS "quantity",
  4.     orders.Seed_ID AS "Seed_ID",
  5.     order_line.R_ID AS "R_ID",
  6.     order_line.Date_order AS "date",
  7.     order_line.no_of_seeds AS "no. of seeds",
  8.     requesters.R_NAME AS "Req" 
  9. from orders,order_line,requesters 
  10. where 
  11.     orders.Order_ID=order_line.Order_ID 
  12.     AND order_line.R_ID=requesters.R_ID; 
  13.  
  14.  

3 4387
Luuk
1,047 Recognized Expert Top Contributor
The query is working but i want to display the Seed_ID's 0f one order separated by comma
You can only do this if you use 'GROUP BY Order_ID'

But how will you show 'quantity' for this seeds?
Should it show the total quantity?

BTW, if you format your query its more readible:
Expand|Select|Wrap|Line Numbers
  1. Select 
  2.     orders.Order_ID AS "Order_ID",
  3.     orders.quantity AS "quantity",
  4.     orders.Seed_ID AS "Seed_ID",
  5.     order_line.R_ID AS "R_ID",
  6.     order_line.Date_order AS "date",
  7.     order_line.no_of_seeds AS "no. of seeds",
  8.     requesters.R_NAME AS "Req" 
  9. from orders,order_line,requesters 
  10. where 
  11.     orders.Order_ID=order_line.Order_ID 
  12.     AND order_line.R_ID=requesters.R_ID; 
  13.  
  14.  
Jun 22 '12 #2
nazish zehra
31 New Member
No i dont want total quantity .Thanku for reply.Got it solved and sorry for inconvenience
Jun 22 '12 #3
nazish zehra
31 New Member
Can anyone tell me about basic tutorial on charts in ireport
Jun 22 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Raj | last post by:
Hi all, I need help tunning the following query Table scan on table Fact.sale_Current_2005 1.select key,sale_amt,dt,c4,c5,c6,c7 from Fact.sale_Current_view where dt>= (select (min(Dt))...
4
by: Robertu | last post by:
Scusatemi ma le pagine di visualizzazione dei dati dal mio database mysql funziona bene tranne quando voglio selezionare meglio i dati della query per visualizzare solo i records che risposndano ad...
0
by: shweta gandhi | last post by:
hi, i m new to iReports & want to create charts in iReports. if anyone knows plz. help me. its very urgent. thanks in advance.
0
by: anuc | last post by:
I am doing webprogramming in JSP.Now I want to connect JSP with IREPORT by using the data of MYSQL.I have no idea about the code.Please help me to give the code. thanks in advance
0
by: rakeshc | last post by:
Hi, I am a new guy in jasper and iReport. I could create a report and subreport successfully with iReport. while running through iReport, it will ask for parameters and after supplying them,...
1
by: madhuparimi | last post by:
I am working on jasper reports.First i want to know how to generate a ireport using stored procedure. Can u please help me out and tell me how to generate an ireport using stored procedure
1
ddtpmyra
by: ddtpmyra | last post by:
Hello, Im looking for PHP and MYSQL report designing tool.... anyone who knows a freeware just like the Jasper IReport? thanks!
2
by: mkotula | last post by:
Hi, Brand new to jasper and IReport with Oracle. Was able to load and connect IReport to Oracle DB and created my first reports. Unable to connect Jasper to the DB nor import my IReport...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.