Run a query that will determine the number of parts to produce
I have the task I have to determine the number of parts that need to be produced based on the number of products sold for the day (each product consists of several parts).I use SQL 11g Express.
I watched this during so long and tried so many different ways. Here's some of what I tried, with the error messages. I don't know where I am going wrong get this calculation. Here, any help is greatly appreciated!
Here's my info:
/**PRODUCT**/
CREATE table Product
(
SKU VARCHAR2(10) NOT NULL,
ProdDesc VARCHAR2(50) NOT NULL,
Price NUMBER(5,2),
PRIMARY KEY(SKU)
);
/**PART**/
CREATE table Part
(
PartID NUMBER(6) NOT NULL,
PartDesc VARCHAR2(50) NOT NULL,
PRIMARY KEY(PartID)
);
/**PRODUCTPART**/
CREATE table ProductPart
(
SKU VARCHAR2(10) NOT NULL CONSTRAINT fk_ProductPart_Product REFERENCES Product (SKU),
PartID NUMBER(6) NOT NULL CONSTRAINT fk_ProductPart_Part REFERENCES Part (PartID),
NumOfParts NUMBER(3),
CONSTRAINT pk_ProductPart PRIMARY KEY (SKU, PartID)
);
CREATE table Customer
(
CustID NUMBER(6) NOT NULL,
CustFname VARCHAR2(20) NOT NULL,
CustLname VARCHAR2(20) NOT NULL,
Company VARCHAR2(40),
Address VARCHAR2(40) NOT NULL,
City VARCHAR2(30)NOT NULL,
State VARCHAR2(2)NOT NULL,
Zip NUMBER(5)NOT NULL,
Phone NUMBER(10)NOT NULL,
PRIMARY KEY (CustID)
);
CREATE table CustOrder
(
OrderID NUMBER(6) NOT NULL,
Qty NUMBER(3) NOT NULL,
OrderDate Date NOT NULL,
SKU VARCHAR(10) NOT NULL CONSTRAINT fk_CustOrder_Product REFERENCES Product (SKU),
CustID Number(6) NOT NULL CONSTRAINT fk_CustOrder_Customer REFERENCES Customer (CustID),
PRIMARY KEY (OrderID)
);
Here are some of the queries:
SELECT ProductPart.Qty
(
SELECT CustOrder.SKU,
sum(CustOrder.qty)
FROM CustOrder
GROUP BY CustOrder.SKU;)
FROM ProductPart
WHERE ProductPart.Qty * sum(CustOrder.Qty)
ORA-00936: missing expression
SELECT o.OrderDate AS "Date Ordered",
o.OrderDate + 5 AS "Date Due",
pp.PartID AS "Part No.",
pp.NumOfParts * COUNT(o.SKU) AS "Qty"
FROM CustOrder o
JOIN ProductPart pp
ON o.SKU = pp.SKU
GROUP BY pp.PartID, o.OrderDate, COUNT(o.SKU)
ORDER BY o.OrderDate
ORA-00934: group function is not allowed here
SELECT ProductPart.Qty,
ProductPart.PartID,
ProductPart.PartDesc
(SELECT COUNT(CustOrder.SKU)
FROM CustOrder
GROUP BY CustomerOrder.SKU)TotalProducts,
ProductPart.Qty * TotalProducts AS "Qty"
FROM ProductParty
WHERE CustOrder.SKU = Product.SKU
AND Product.SKU = ProductPart.SKU
ORA-00936: missing expression
SELECT ProductPart.Qty,
ProductPart.PartID,
ProductPart.PartDesc
(SELECT sum(CustOrder.qty)
FROM CustOrder
GROUP BY CustOrder.SKU)TotalProducts
ProductPart.Qty * TotalProducts
FROM ProductPart
ORA-00936: missing expression
Tags: Database
Similar Questions
-
How can I determine the number of contacts that I have
How can I determine the number of contacts that I currently have on my iphone
I don't know of a way on the iPhone, but if you have a Mac, you can go to the Contacts (platform) app and scroll to the bottom where you will find the total.
Same for iCloud.com on your browser, go to the app, scroll down.
-
A script that will count the total number of pages into multiple PDF files in a batch file?
Is there a script I can use ExtendScript Toolkit that will count the total number of pages into multiple PDF files in a batch file?
In another discussion I showed a JavaScript that you can use to write the number of pages to the console in a batch sequence. You would do exactly the same thing in Action, so the action would consist of a simple JavaScript (more tools > run JavaScript) which includes the code.
-
Does anyone know of a VI or how to write one that will stop the computers clock be turned off if an application is run. The time and date can be reset normally while an application is running by clicking on the time in the lower right of the screen of the computer. I have an application that runs over several days and it is essential that the time and date of the computer not be changed. Is there an easy way of this lockout the user? Note that I am what I consider a beginner advanced in LV
Thank you
Chuck
This isn't something that you can from LabVIEW, because this is an operating system operation, and it will depend on the operating system you are using. Under Windows, you can use Group Policy to control this. Please Google on "prevent changing the date and time of windows."
Also, please try to refrain from stuffing your message in its entirety in the block of material. Keep short, but descriptive enough topic so we can understand what you're asking basically. Thank you.
-
Friends of Hy. I want to ask that I am looking to get a pdf split software to split a pdf file into several PDF files with my set of pages specified. As if a document is 22 pages then I will specify the number of pages that must be cut in half in separate PDF files. for example I entered that do three pdfs of 1-5, 5-7, 8-10 pages and it will result in me
first pdf = 1-5 pages
second pdf = 5-7 pages
Third pdf = 8 to 10 pages.
Y at - there no way to do it with adobe acrobat or any other software? I tried many software including adobe with extract and split option, but I did not get the results you are looking for. so please:
I would like to know if any of you have any knowledge about it. I have
Thnanks in advance!
Hi minixain,
Yes, you can do it using Adobe Acrobat application (Adobe Acrobat free trial downloadversion |) Acrobat Pro DC), please refer to this document for help KB split a PDF | Adobe Acrobat DC tutorials.
Kind regards
Nicos
-
Question about a query that will be 1 for the first 10 lines, 2 for the
Hi all
I am trying to write a query that will be 1 for the first 10 lines, 2 for the next ten lines and so on.
I tried several approaches such as mod, rank, case but could not get the correct idea.
Grateful if someone can give me a hint on this one.
Ex:
Col1 Col2
1 989
1 120
1 876
2 121
2 456
2 87
1 of 3
3 22
3 333
....................... and so on..
Thank you
MK.How about this:
His past all my tests so far
select trunc((rownum - mod(rownum-1,10))/10)+1 from dual connect by level <= 1000
-
Determine the number of traditional DAQ hardware using Labview.
Hello
Anyone can answer the question:
Regarding materials traditional DAQ, for example the DMM OR-4060, how
can I programmatically determine the number of device which can be seen in MAX?
With the help of Labview 8.5, I looked into the following function libraries:
NOR-DMM
VISA
NOR-ModInst
None of the libraries above seem to provide access the number of traditional DAQ hardware
property, which is automatically assigned.
Background:
I have a 18 PXI chassis containing 2 DMM, in housing 3 and 14.
The DMM may be a mixture of type OR-4060 or NOR-4070.
The system is controlled by a Teststand sequence employing IVI - DMM
steps.
When you set the IVI logical name step, I am referring to IVI device defined Sessions
Max - rutime determined.
Labview VISA functions using I can determine the model, i.e. 4060 or 4070.
Because the DMM just locate into the slots 3 or 14, then the devices NOR-4070
are accessible using the following descriptors of resources: PXI1Slot3 or
PXISlot14.
(The 4070 is compatible DAQmX.)
So for devices OR-4070, I can predefine 2 Sessions of IVI device, knowing
It will be sufficient for all occasions, when I run my Teststand sequence, which will be
determine what device session to use at run time.
But I'm stuck for the NOR-4060.
At the Session of the device, I have to give a descriptor of resource the following
format: DAQ::x (where x is the device number)
I could create device 18 sessions each reference to a different DAQ::x, but to select
the good pair during execution, I would need to programmatically determine the device
number, i.e. the value of x.
Where my question.
The closest I came to a solution was an entry of the Knowledge Base that said that the
Assigned device number would be the same as the slot number, providing the
Number of the device had not previously configured manually.
Unfortunately, our device numbers have been changed manually and maybe in the future.
All popular solutions.
Gary.
Hi Gary,.
Good afternoon and I hope that your well today.
Thanks for your post and I want to help you solve your problems.
I don't think there is just a function that you can use to identify and collect information on all cards with your. For traditional DAQ devices in particular I suggest using the Information.vi of DAQ devices get.
If you look at this link,
SAL posted an example VI entitled, find dev trad.vi.
You can get information such as serial number, Dev name and the Base address.
The assistance of the respective drivers to collect information you could generate an array of strings with the information that you need all the slots.
Please let me know if this is useful at all,
-
How to determine the number XP or XP 64-bit operating systems.
Hello
I need to download a driver but need to know if I have Windows XP, XP 64. I run Internet 7 SP3 if that makes a difference. Properties-General-he reads the slot system Microsoft Windows XP Home Edition Version 2002 Service Pack 3. I think this answers the question that it is not XP 64 but want to make sure and would appreciate any help.XP Home does not come as an x 64 version.
How to determine whether a computer is running a 32-bit version or the 64 bit version of the Windows operating system. http://support.Microsoft.com/kb/827218
Windows XP if you have Windows XP, there are two ways to determine if you are running 32-bit or a 64-bit version. If one does not work, try the other.
- Click Startand then click run.
- Type sysdm.cpl, and then click OK.
- Click the general tab. The operating system is displayed as follows:
- For a 64-bit version operating system: Windows XP Professional x 64 edition Version < year=""> appears under System.
- For a 32-bit version operating system: Windows XP Professional Version
appears under System.
Note
is a placeholder for a year.
- Click Startand then click run.
- Type winmsd.exe, and then click OK.
- When System summary is selected in the navigation pane, search for processor under item in the details pane. Note the value.
- If the value that corresponds to processor starts with x 86, the computer is running a 32-bit version of Windows.
- If the value that corresponds to processor starts with ia64 or AMD64, the computer is running a 64-bit version of Windows.
If you cannot determine the number of bits of the operating system with these methods, go to the "Next steps" section (of the KB article)
-
determine the number of pages of a pdf prior to any operation on it
Any of you know how to determine the number of pages in the pdf file (selected with the Open for example)?
Somehow, I can't understand how to do that any way short of actually opening/pixelation all pages without prior knowledge of the actual number.
I would like to use this information to determine the number of items to a contact-sheet-like procedure beforehand.
MultiPageImporter2.0.jsx, which is an Indesign Script by Scott Zanelli, obviously the fact, but so far I have failed to properly use its functions.
Anyway, have a good weekend
pfaffenbichler
OK, now it works...
Install x script changing the CSx version
Then run this script by changing the location of pdf and the version of CS... (NB: does not work with CS2.) CS, CS3, and CS4 should be ok)
/////////////////////////////////////////////////////////////
var pdffile = file ("~/Desktop/56 pages.pdf") .fsName;
////////////////////////////////////////////////////////////
var file = new File ("/ Applications/Adobe Photoshop CS3/Presets/Scripts/macexec.app/contents/macexec");
var pdfcnt = File ("~/pdfcnt");
If (pdfcnt. Exists) pdfcnt.remove ();
{if (file. Exists)}
leader. Open ("e");
leader. Encoding = "BINARY";
leader. Write ("/ usr/bin/LDM - name kMDItemNumberOfPages");
leader. Write ("\""+pdffile+"\"|/usr/bin/grep o [0-9]------+ $ > pdfcnt \n");
The following line closes all Windows Terminal.
file.writeln ("/ usr/bin/osascript - e ' tell \"Terminal\ request "to quit" ");
leader. Close();
}
leader. Execute();
var test = false;
{while (test)}
if test (pdfcnt.exist) = true;
$.sleep (50);
}
for (var t = 0; t)<>
If (pdfcnt. Length > 0) break;
$.sleep (50);
}
pdfcnt. Open ("r");
var number = parseInt (pdfcnt.readln ());
pdfcnt. Close();
Alert ("number of pages in" pdffile + "=" + count);
-
determine the number of Monday, Tuesday, Wednesday and Thursday in a month
Hello all;
I'm still trying to think and understand it. Y at - it a syntax that you can use to determine the number of Mondays, Tuesdays, Wednesdays and Thursdays for a month for a given year, taking into account leap years.
Thank you.Hello, welcome to the forums.
Something like this should do it:
with day_tab as ( select mon_dt + level - 1 dt, to_char(mon_dt + level - 1, 'DY', 'NLS_DATE_LANGUAGE=''ENGLISH''') dy from (select trunc(to_date(m || '/' || a, 'MM/YYYY'), 'MM') mon_dt from (select &v_month m, &v_year a from dual)) connect by mon_dt + level - 1 <= last_day(mon_dt)) select count(*) cnt_tot from day_tab where dy in ('MON', 'TUE', 'WED', 'THU');
Run the example:
SQL> var v_month number SQL> var v_year number SQL> exec :v_month := 2; PL/SQL procedure successfully completed v_month --------- 2 SQL> exec :v_year := 2000; PL/SQL procedure successfully completed v_year --------- 2000 SQL> with day_tab as ( 2 select mon_dt + level - 1 dt, 3 to_char(mon_dt + level - 1, 'DY', 'NLS_DATE_LANGUAGE=''ENGLISH''') dy 4 from (select trunc(to_date(m || '/' || a, 'MM/YYYY'), 'MM') mon_dt 5 from (select :v_month m, :v_year a from dual)) 6 connect by mon_dt + level - 1 <= last_day(mon_dt)) 7 select count(*) cnt_tot 8 from day_tab 9 where dy in ('MON', 'TUE', 'WED', 'THU'); CNT_TOT ---------- 17 v_month --------- 2 v_year --------- 2000 SQL>
If by chance you want to see a number of days of the week just to use a group of:
SQL> with day_tab as ( 2 select mon_dt + level - 1 dt, 3 to_char(mon_dt + level - 1, 'DY', 'NLS_DATE_LANGUAGE=''ENGLISH''') dy 4 from (select trunc(to_date(m || '/' || a, 'MM/YYYY'), 'MM') mon_dt 5 from (select :v_month m, :v_year a from dual)) 6 connect by mon_dt + level - 1 <= last_day(mon_dt)) 7 select dy, 8 count(*) cnt_tot 9 from day_tab 10 where dy in ('MON', 'TUE', 'WED', 'THU') 11 group by dy; DY CNT_TOT --- ---------- WED 4 TUE 5 THU 4 MON 4 v_month --------- 2 v_year --------- 2000
If you want to list these days, with a number by day of the week:
SQL> with day_tab as ( 2 select mon_dt + level - 1 dt, 3 to_char(mon_dt + level - 1, 'DY', 'NLS_DATE_LANGUAGE=''ENGLISH''') dy 4 from (select trunc(to_date(m || '/' || a, 'MM/YYYY'), 'MM') mon_dt 5 from (select :v_month m, :v_year a from dual)) 6 connect by mon_dt + level - 1 <= last_day(mon_dt)) 7 select dt, 8 dy, 9 count(*) over (partition by dy) cnt 10 from day_tab 11 where dy in ('MON', 'TUE', 'WED', 'THU'); DT DY CNT ----------- --- ---------- 21/2/2000 MON 4 7/2/2000 MON 4 28/2/2000 MON 4 14/2/2000 MON 4 17/2/2000 THU 4 3/2/2000 THU 4 24/2/2000 THU 4 10/2/2000 THU 4 29/2/2000 TUE 5 8/2/2000 TUE 5 1/2/2000 TUE 5 15/2/2000 TUE 5 22/2/2000 TUE 5 23/2/2000 WED 4 9/2/2000 WED 4 2/2/2000 WED 4 16/2/2000 WED 4 17 rows selected v_month --------- 2 v_year --------- 2000
Published by: fsitja on July 5, 2010 13:49
-
How to use NIDAQmx to determine the number of lines correlated DIO?
How can I used NIDAQmx to determine the number of correlated DIO lines that supports a device? For example, the NI6225 supports 8 correlated digital of/s lines while the NI6229 supports 16 correlated digital of/s lines. How can I used NIDAQmx to determine the NI6225 supports only 8 lines while the NI6229 supports 16 lines?
I moved this question from a previous thread.
Thank you
Ian
Here is a code snippet that implements the regular expression detection:
-
Determine the number of channels selected for traditional DAQ
The blocks 'DAQmx task' and "Traditional DAQ Channel" look pretty similar (see attachments). The DAQmx block ist an individual selection of channels and I am able to determine the number of selected channels.
Now I am trying to determine the number of selected channels to a traditional DAQ, but the property DAQmx block does not work here. I already tried the trad to some form of blocks. Range of data acquisition, but failed.
Any idea?
In traditional DAQ, there are several ways of specifying the list of channels. Assuming that your picture shows how you use your channel list is just a string of delimited by commas. Wire a constant to a string array node worksheet and specify "comma" as the separator and the number of columns must tell you the number of channels.
Ben
-
determine the number of monitors
How can I determine the number of screens in Labview. In Labwindows you ATTR_NUM_MONITORS but I can't find the equivalent command in Labview.
Remove a property node. It will already have the default Application class. Select the view > property all monitors, which is a table with details of all the monitors. You can watch its size for the number.
-
Essbase calc script to determine the number of occurrence
Hello
is it possible within a calc script to determine the number of occurrence of a value in the account dimension?
I have an account called ranks which can contain any value between 1 and 10. I would like to know how many times each value is repeated for a specific cost center. It's in a database of planning BSO.
Thanks in advance for your contributions...
CL
This isn't the typical calculation you would do in an OLAP architecture, but yes it is certainly possible.
you will need to create 10 accounts such as occurrence_of_1, occurrence_of_2 etc.
Then you increment them according to the value of the 5th year.
Don't forget to put in your calculation!
-
Determine the number of the motherboard Dell PowerEdge T410
I work with a server remotely try to determine the number of points for our mother. It's a PowerEdge T410, nothing is coming through system information or serial number. In my view, that there is a certain different models available. Is there anything that can help me refine it? We have tried to add a second processor and discovered that the second take was damaged by the manufacturer.
Antares-USA,
Normally, when you enter your number at support.Dell.com, you can click on the System Configuration and then see the original setup the server was in when he left. If that does not produce the information, then you must simply PRIVATE MESSAGE the serial number for me and I can let you know the motherboard installed.
Make sure of me private message with the information for your security.
Let me know.
Maybe you are looking for
-
How can I move Mozilla Add-ons to a computer kiosk offline?
I designed and installed kiosks in a museum that use Mozilla their front-end. I had a slight problem with the add-on current that they use and need to change. Unfortunately, the Museum is on a marine base and not connected to Internet. Download porta
-
Hello My Libretto U100 top box is silver and white. However, I ve seen pictures on the Internet of a U100 with a blue suitcase. Are there several models of Libretto´s U100 with different colors? Another doubt, what Holster do you recommend for a Libr
-
I'm having a rather funny problem I can't find what is happening. I have a QMH structure with several line-ups at several control loops. I have the exit button linked to cases of output on all my curls, but when I hit the exit button, LabVIEw does no
-
Generation of application error 1003
Hello I have a project and when I try to create it in an application I get an error saying a VI in broken and of course, it isn't. Here are the details of the error: "Error 1003 has occurred to AB_Targetfile.lvclasspen_Top_Level_VIs.vi-> AB_Build.lvc
-
Vista is unable to clean install on Gateway Laptop
Midway through the installation process, the error message says that it cannot find the files needed. Disc is clean, no scratches and has been used before for a clean install of Vista successfully. using the external DVD drive. created the startup k