Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I am developing an application Webdynpro java where I need to write a SQL query. I have scenario where I need to display data according to Business group. There are numerous business groups under each of them there are numerous sites and all these sites have data filled by them in a given form. When the user select the Business Group and month and year, it should show the data all site-wise under that business group. Then what will be the SQL query for that?
Posted
Updated 3-Sep-14 0:58am
v2
Comments
PhilLenoir 3-Sep-14 9:07am    
We can't help you with a query without knowing your schema. I suggest reading any standard on-line help for SQL SELECT query syntax.

1 solution

The prior comment is correct. More information about the schema is needed.

In general, you will need 2 things.

1) a sql query

2) the java code to execute the code and iterate over the results returned.

I cannot help with #2 at all. I am not a java coder.

I can give you a framework to start from for #1 but I know it is incomplete and should just be viewed as a starting point.

Your SQL query will be something like:

select
Field01,
Field02,
...
Field_n
from YourTable
where BusinessGroup = 'group_x'

The select keyword is followed by a list of column names (Field01 etc) separated by commas.
The from keyword is followed by the name of the table(Yourtable in my example) that contains the rows you need to return.
The where keyword is followed by a logical expression that is true for the records you want returned to you.(the column named BusinessGroup needs to contain the string in single quotes in this case group_x)

I hope this gets you started.
Don
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900