Thanks for your attention to answer the question.
You can understand this problem seeing Above image or
My Question is that I have table1 in which I am inserting Issue Items details and I have table2 in which I am inserting Receive Items details. There are two case which have to cover first case is - when I issue 3 items and receive 5 Items Or second case is - when I issue 10 Items I receive 4 item. Please help to give the solution for the same.
I tried joins and union to solve this but did not resolve it.
Related
I am trying to get a list of users, who submitted a specific event in a website, however when I run the query, I am not getting the full result set - for example, I found 2 users who had the event (and I used the same conditions), but are not in the result set.
The script looks like:
select userid
, Date
from c
where year(c.Date) = 2018
and week(c.Date) = (week(getdate()) - 1)
and Event in ('existing', 'submit_existing', 'submit_new')
group by 1,2
Can anybody give me a hint what might be the issue?
If anything is unclear or if you have any questions, let me know!
Thanks!
https://github.com/dbeaver/dbeaver/issues/1708
Ctrl+Alt+Shift+A or right click menu: Execute => Select all rows.
so I managed to find the answer!
The reason for my problem is that in dbeaver there is a Maximum result-set size filed and if you have a lower number than the result set you are expecting - you will get duplicates and missing data, because each time it runs it shows a new results set.
Hope this can help somebody!
I am doing a beginners' SQL tutorial and I started to wonder whether a simple SQL query on this table: http://www.sqlcourse2.com/items_ordered.html could tell the number of items (also 1) which have only been purchased more items at a time, so there is no record which contains the quantity column with a value of 1 AND the item. I am really beginner at this so please try to keep it simple.
Thank you in advance!
Welcome to the fascinating world of SQL.
Well - I'm not giving you the answer, but a hint (after all, it's a training and your own thinking and finding the solution would be the best way for you to learn something new).
The way you formulate your question is somewhat puzzling.
When I combine what you ask with what is possible with SQL, the question that would make sense to me would be that you need to list (or count, I did not understand that very well) the items (or the complete rows in the table with matching item, that was not clear either), that were never sold with a quantity of 1.
If that's what you need, you will need a subselect to get all distinct items that were sold with a quantity of 1, and select the rows from your base table whose item value is not in the list you get from the subselect.
Do you need more hints?
Marco
I'm kind new in this forum but I'm stuck in a problem and I need our help.
I Have one table with several lines where each line represent one project, then in another table I'll have many tasks that need to be done in each project, each task would have a percentage of at what level is, and the result of this two tables is one table where I'll have the process Id and also the percentage of accomplished with the average of the last entries of every tasks values.
I can't figured out the query that needs to be done to have the result that I want.
Can anyone help me? You can see follow the link bellow to see tables and the result that I want.
Table iamges
I didnt understand the colors of rows you used, but with your description, i think this is the query you are looking for:
select P.id_Proceso, P.SubProceso, avg(R.estado)
from Processos P
join Registros R
on P.ID = R.Id_processo
group by P.id_Proceso, P.SubProceso
Due to recent updates to the recent database, I have run into a weird problem. I have two tables, tVehicleDeal table and tVehicleLog table. We did a 'migration' meaning we created an app that will transfer the data from a old database to a more relational database. This process took awhile, but it finished and everything seemed good to go. What happens now, is that anytime tVehicleDeal is updated, the corresponding information is inserted into tVehicleLog. The problem that has occurred is.. I ran a script that would update the current deal in tVehicleDeal to the most recent log in tVehicleLog. I made an error in my script, and not all the current deals in tVehicleDeal were updated properly. As a result, when the users updated the active deal in tVehicleDeal, not all the information was inserted into the tVehicleLog. I need to find a way to update the newest entry with some fields from the past entries such as the date it was titled. Some Deals have as many as 20 different logs for it whereas some may have only 2 or 3. I have found this link here but I'm not 100 percent positive this is what I'm looking for. I have tried something similar to this but I am unable to get anything to work using the examples found on that page. Any other ideas will help greatly!
EDIT:
What I am unable to figure out is how to update a column in tVehicleLog. For example:
In the tVehicleLog table there are 6 results for a particular DealID.
The first through 4 do not have a titled date in it, but the 5th row does have a titled date.
I can't figure out how to update the titled column the 6th row for that dealID based on the 5th row that does have the titled date.
The link provided above looked like it was something I was looking for but I was unable to get that solution to work.
Based on this line from your question,
I can't figure out how to update the titled column the 6th row for
that dealID based on the 5th row that does have the titled date.
It seems like this should fix your problem. It is written only to solve this specific scenario. If other scenarios exist that are not exactly like this one, adjustments may have to be made. If I didn't understand your problem, please post further clarification.
UPDATE L1
SET TitleDate=L2.TitleDate
FROM tVehicleLog L1
INNER JOIN tVehicleLog L2
ON L1.DealID=L2.DealID
AND L2.TitleDate IS NOT NULL
WHERE L1.<PrimaryKeyColumn>=#ThePrimaryKeyColumnOfTheRowYouWantToUpdate
http://imageshack.us/photo/my-images/837/6uvs.jpg/
I have the following tables and relationships.
When loading the NEW_CHALLAN form, I am trying to fill a Grid View with Product Details - Product Name, Stage, Pro, Katta, Packing, Rate, Quantity.
I am facing a problem (getting 0 records as result set) when using JOIN for this operation as there are no matching records(ChallanId, ProductId, OrderId) in the ChallanProductDetails table yet (when loading the form)
Any suggestions on how to solve this problem ?
If you are trying to load product details even tough there are no order/challan details then you can try something like below,
select a.productname,a.productprice,c.stage,c.pro...etc from product a
left outer join challanproductdetails b
on a.productid= b.productid
brother I am not sure what exactly your asking for is it to retrieve data from a view or two tables if you are retrieving only then why don't you create a view of two tables and just call it straight to the grid that will be easy.
Please correct me if I am wrong.