Result set must be in groupings - MYSQL - mysql

I am making a report using java code and it is working fine (Image Right).
Now I want to convert it to BIRT.
Since BIRT focuses on Query, I have to change my java code to plain query. Problem is, I have a for each loop on java query where mysql doesn't have.
I found similar query in here but it did not work on me.
As of now, using plain query this is my result:
BIRT RESULT
What am I missing in here? Here's my code.
SELECT item.No_, item.Description, item_ledger_entry.Item_No_,
item_ledger_entry.Description,item_ledger_entry.Posting_Date,
item_ledger_entry.External_Document_No_, item_ledger_entry.Document_No_,
item_ledger_entry.Location_Code, item_ledger_entry.Quantity,
item_ledger_entry.Entry_Type
FROM pbsdev3.item, pbsdev3.item_ledger_entry
where item.No_ = item_ledger_entry.Item_No_
and item.Description = item_ledger_entry.Description
group by item.No_;
I am a very fresh coder so I don't have much knowledge yet.
The result I wanted Look like this(It must be this)
This is the item Table and the item_ledger_entry
Help much appreciated!

Actually, your query is good working good. Make sure you are using Table instead of grid. Table is better than grid when it comes to multiple data.
And by the way, you don't need that groupings.

Related

BigQuery view integer column read as Json when imported in PowerBI

I have created this view in BigQuery:
create view project.dataset.view1 as
SELECT
o.first
,o.id as theid
,p.id as otherid
FROM dataset.view2 as o
JOIN dataset.view3 as p on p.whatever = o.id
When i add the data in that view to PowerBi, the column p.id it shows as Json string with all the three columns, while it should be only an integer.
This is an example of what i see:
{""v"":{""f"":[{""v"":""name""},{""v"":""11""},{""v"":""9""}]}}
In BigQuery it just looks fine with the integer value I'm expecting.
Can somebody shed some light on this? It's driving me nuts. Thanks.
Ok, i don't know how much of a bug vs my fault this is. i have named the 3rd column just like the view.
Not sure here if it's a good thing to do, but again, Google Data Studio and KlipFolio didn't give me that result.
Changing the column name fixed it though in PowerBI.

like and not like in access query

I want user to be able to filter results for a query to either INclude or EXclude a string based on value in a checkbox.
The Checkbox is referenced correctly and when checked does indeed filter just on Hackney, however when unchecked the "not" part gives (wrongly) zero records
IIf([Forms]![Navigation]![TEST]=True,"Hackney",Not In ("Hackney"))
Any suggestions very welcome, been trying different options all morning.
You can not do what you are trying to do. You are trying to build your SQL query through this IIf statement.
Based on what I believe you want, what would work in your case is the following:
select ... /* your select fields */
from .... /* your table(s) */
where .... /* the rest of your conditions */
and (
([FieldName] = "Hackney" And [Forms]![Navigation]![TEST] = True)
or
([FieldName] Not In ("Hackney") And [Forms]![Navigation]![TEST] = False)
)
Excellent stuff thanks so much that works a treat. In fact actually works fine when you look at it through Query Builder (which suits better for a variety of reasons).
For anyone else struggling with this I've taken it a bit further after this tip and linked the like/not like to a value in a combo, rather than the hard coded "Hackney" mentioned above. Also works in Query Builder, this gives my users a lot of flexibility in running their own queries properly.
Thanks again. The SQL for this is:
SELECT Clients.CLIENTSID, Clients.FirstName, Clients.LastName,
LondonBoroughs.LondonBorough, Clients.LondonBoroughID
FROM LondonBoroughs INNER JOIN Clients
ON LondonBoroughs.LONDONBOROUGHSID = Clients.LondonBoroughID
WHERE (((Clients.LondonBoroughID) Like ([Forms]![Navigation]![ReportsLondonBoroughCOMBO]))
AND (([Forms]![Navigation]![TEST])=True))
OR (((Clients.LondonBoroughID) Not Like ([Forms]![Navigation]![ReportsLondonBoroughCOMBO]))
AND (([Forms]![Navigation]![TEST])=False));

Crystal Report Self Joins

I'm trying to put a report together using Crystal Reports. I have to display a list of "class numbers" and the description of those classes. If there are prerequisites for those classes, I need to list those (the class number) as well as a description/title.
Currently I am able to display everything but the prerequisite descriptions. I believe I have to preform a self join since I'm only using one table. What I've done so far is use the command option when entering the tables I want to use for the report. In that command I have
SELECT Main.prerequisite, Sub.course_no, Sub.description
FROM course Main
JOIN course Sub ON Main.prerequisite = Sub.course_no
where main.prerequisite is not null
The table is called "course" while the columns are "course_no", "description", "prerequisite".
Anytime I add "description" to the report, it only gives me the course_no's corresponding description, not the prerequisite description.
I'm not sure what I'm doing wrong or what I'm not doing at all, but any help would be greatly appreciated. Thank you.
I figured a work around and thought I should post it here. Hopefully to avoid wasting anyone's time as well as providing my solution to anyone that may have a similar issue.
I simply created a view in SQL
Create view preReqs AS
SELECT Main.course_no AS [course_no]
,Main.description AS [description]
,Main.prerequisite AS [prerequisite]
,Sub.description AS [preReqDescription]
FROM course As Main
LEFT OUTER JOIN course As Sub ON Main.prerequisite = Sub.course_no
After I created that, I just imported the view instead of the table itself into the Crystal Report. I was then able to group by whatever I wished.
Hopefully this will help anyone else that may run into this issue. Thank you for everyone that provided their time/input as well. I appreciate it.

How to group items within a groupedList on Sencha Touch 2?

Ok, I've spent the day getting my models, stores and views all setup.
I have the ajax and grouping working fine for my ListView.
My question is, I want to order & group by 'day' and inside of that grouping, I want to group by 'order_id'.
Can this be done? Would it be a new view inside the list's cell?
I'm new to Sencha and have searched all through their docs/google/etc.
Thanks for any insight.
Take a look at the grouper config on Ext.data.Store. You may have to be a bit creative with the logic, but you should be able to accomplish it.
In the end I didn't need a list within a list.
I ended up resolving this by changing the JSON format it was receiving and then using Ext.XTemplate(); looping through using <tpl for="items">.
Thanks for the comments anyways.

sfPropelPager reduce queries

i'm working in a symfony project and using sfPropelPager to show a paged list of elements.
The problem is that with a great amount of data to list (i.e. thousands of registers) it makes a query to the database for each page to show!!!! That means about 100 extra queries in my case, and that is unacceptable.
Showing some of my code: the function that returns the pager object
$pager = new sfPropelPager('MyTable',sfConfig::get('sfPropelPagerLines'));
$c = new Criteria();
$c->add('my_table_field',$value);
$c->addDescendingOrderByColumn('date');
$pager->setCriteria($c);
$pager->init();
return $pager;
So, please, if you know a way to get all the results with only one query, it would be a great solution for my problem. Otherwise i must implement that list with an ajax call for every page the user wants to see
Thank you very much for your time.
I'm not sure to get your problem but, anyway, avoid the use of Criteria. Try to make queries with the ModelCriteria API: http://www.propelorm.org/reference/model-criteria.html.
For each paginated page, a query to the database will be done, this is the standard behavior for all pagers I know. If it's related to related objects (assuming you want to display information from relations), you may want to create a query that links those objects before to paginate, that way you'll get one query per page for all your data to display.
Read this doc for instance: http://www.propelorm.org/documentation/03-basic-crud.html#query_termination_methods
At last i did'nt get a solution for the problem, i had to implement the list via AJAX call, calling to a function that returns the requested page, so at the load of the page, no query for this list is slowing the user experience.
Thank you anyway to help me :)