440 Posted Topics
Re: Hi >>> Or do i leave the 4 existing items where they were and put the two new items in elements [0] and [1] ? Yes, for it is a circular buffer, and as Momerath already stated "store the new value at the 'next' pointer and [COLOR="Green"]increment it modulus the … | |
Re: Hi your task can easily be solved by means of a sub-select, in principle: [CODE]select * from yourtable where sequence in (select max(sequence) from yourtable group by ...) order by ...;[/CODE] Now your personal task is to figure out how group-by and order-by clauses must look like to meet your … | |
Re: You need something like that: [CODE]update products set quantity = quantity - quvalue_from_admin_list where id_quantity = idvalue_from_admin_list [/CODE] Obviously, in PHP code from your other posting you also need to replace INSERT by above UPDATE ... -- tesu | |
Re: Hi I am really confused, how is your "set of values (1,4)" related to your example table? An why you decide that then you should get the names 1 and 2? The names 1 and 2 point to what of your example table? I understand that your table is kind … | |
Re: Maybe you replace INSERT by something like this: [CODE]update products set quantity = quantity - quvalue_from_admin_list where id_quantity = idvalue_from_admin_list [/CODE] This would somewhat coincide with your other posting. I have assumed that your admin's list is a sales list, therefore quantities on stock must be reduced by sold amounts. … | |
Re: Hello The cos-function y = cos(x) gives a value y which is from [-1 ... +1]. Its parameter x must be radians, that is for example -2*pi ... +2*pi, also values > 2*pi are allowed. Therefore the parameter y of the restricted inverse function x = acos(y) must always be … | |
Re: Hello There is something more to do. Hint: First add a column to your table which simply indicates present and absent booking timestamps. Below is an example of a table with computed column [I][COLOR="Green"]isPresent [/COLOR][/I] and ordered by [I]PersonalNumber [/I] what I had already published elsewhere: [CODE]/* PersonalNumber BookingStamp isPresent … | |
Re: Hello I would do that with a user defined function or with any other .net programming language or even Java. Do you know Transact SQL, the SQL Server´s programming language which is very similar to standardized PSM language? Below user defined function, written transact-like, should insert @nbofRows in column lotnumber … | |
Re: This algorithm is linear in time. On a 100000 x 100000 chess board it lasts about one second for medium-fast computer. Possibly your program is running in endless loop. -- tesu | |
Re: hello you may try this:[CODE]select userid, personid, positionid, count(positionid) as cntpos from yourtable group by userid, personid, positionid having cntpos > 1;[/CODE] btw, your table isn't that well normalized. -- tesu | |
Re: Hello Derby/JavaDB & JDBC/type2/3 is a perfect basis, I also use it in netbeans-developement. If you put all attributes together in just one relation/table, you will run into problems like insert/update/delete anomalies. Then you will be forced to patch by Java code for SQL queries will not work or too … | |
Re: Only starting hint, google this: generalization specialization relational modeling Now it's your turn. You may post in what you will then have decided, and we will discussing and possibly also improving your results. -- tesu | |
Re: Glad to meet you again. Are you still suffering from the old database problem we were talken about in [URL="http://www.daniweb.com/forums/thread294619.html"]this[/URL] thread? What about the ERM fragment I sent you in the very last post of that thread, wasn't there any chance to improve data model? As for your first select, … | |
Re: I would make use of [URL="http://en.wikipedia.org/wiki/Cramer%27s_rule"]Cramer's[/URL] rule and the rule of [URL="http://en.wikipedia.org/wiki/Rule_of_Sarrus"]Sarrus[/URL] which are easy to use for linear equations in three variables. -- tesu | |
Re: Well, if I understand you correctly, then you want to select all product types together with the product types associate with a relevant team within a single query. This can be done by set operations union and difference or by subselects. I'll explain it step by step. First, let me … | |
Re: Let me try to explain what happen when your query executes: To filter out all rows having '4' key [I]question_id[/I] is used. 547 rows are affected. Next step is sorting the result set in descending order on column [I]score[/I]. Obviously there is no Index/key on this column which could support … | |
Re: Hello Well, you could get better help if you were more precise on which tables exist and, important too, how they are related to. As rch1231 already did I also see some of these objects: 1st usertable pk(ipaddress, userid) ? 2nd useractivitytable fk(ipaddresse, userid), what pk ? 3rd activitytable pk(activityid) … | |
Re: Hi These tables can hardly be joined together for the 2nd query does not contain table [I]v_Add_Remove_Programs[/I] of 1st query. Possibly the program what auto-generated the second query could know how [I]v_Add_Remove_Programs[/I] is related to the tables [I]v_GS_LOGICAL_DISK[/I], [I]v_FullCollectionMembership[/I],[I] v_R_System[/I] etc. of 2nd query. One also need to know where … | |
Re: [QUOTE=james ang;1301711]So let’s say i have a table with one column containing the following 6 records: [SR No#]='111' [Club Name], [Problem / Symptom Description], [SR No#]='111' [Club Name], [Problem / Symptom Description], [SR No#]='222' [Club Name], [Problem / Symptom Description], [SR No#]='222' [Club Name], [Problem / Symptom Description], [SR No#]='333' … | |
Re: Well, and the body of function factorial(...) should be better completely replaced by [CODE]{ if(input<=1) return 1; else return input*factorial(input-1); } [/CODE] | |
Re: Hello, there is a wrong primary key reference in your code, examine red-coloured lines: [CODE]USE streamlibrary; DROP TABLE IF EXISTS streamlibrary.FileProperties ; CREATE TABLE IF NOT EXISTS streamlibrary.FileProperties( [COLOR="Red"]PK_fileName VARCHAR(50) NOT NULL,[/COLOR] extension VARCHAR(4) NOT NULL , sizeMB DECIMAL(3) NOT NULL , location VARCHAR(50) NOT NULL , data VARCHAR(45) NOT … | |
Re: Well, you are working on MS SQL Server. The error message: [COLOR="Red"]Violation of PRIMARY KEY CONSTRAINT 'PK_text_data'. Cannot INSERT duplicate key IN object 'text_data'.[/COLOR] means that the new row you are trying to insert in table [I]text_data[/I] already exists. That happens if one inserts same data twice. You can examine … | |
Re: Hello, If I understand you correctly, there is a many-to-many relationship between METER and TC where the linking table is HISTORY (has got pk serial and tc from METER and TC). Primary key of HISTORY consists of (serial, tc, week, create_date). Then the select could be: [CODE]select h.`week`, h.create_date, ... … | |
Re: There are many people looking for normalized hotel systems. Even Richad Nixon once did so in China by the time Edgar Frank Codd borrowed the normalization theory from him. So can you be more specific? What have you got so far? | |
Re: Kalimera, ti kanis (supposing you are living in the south part) UML-CS Actors could also be entities on ERM (and tables on RM later) depending on their relevance and scope of their data. Usually they are attributes of an entity named ACTOR, if necessary. If you had disclose some more … | |
Re: Hello Yes, company is not an entity. Your explanation is correct. If your application is to manage many such parcel-service companies, it were a multi-client software (like SAP R/3). There are further entities I have found at a first glance: - Delivery_options and conditions - Serice_stations, especially where packages are … | |
Re: Hi Supposing your both queries select staffids which are not on holidays OR in sessions you should select staffids which are in both result sets: [CODE]select * from staff where staffid in (your select not on holidays ) AND staffid in (your select not in sessions);[/CODE] -- tesu | |
Re: Hello first, put your code between code tags and improve formatting: [CODE]select dp.product_lob As lobs, SUM(fs.written_premium_amt_ytd) As Gross_written_premium [B]from[/B] [COLOR="Green"]--xxx--[/COLOR] opening parenthesis (select dp.product_lob As lobs, SUM(fs.written_premium_amt_ytd) As Gross_written_premium FROM dbo.Fct_Summary as fs inner join Dim_product as dp on ( fs.product_key = dp.product_key ) inner join Dim_Calendar as dc on … | |
Re: Both updates require different where-clauses. Therefore you can't do these updates within one update-statement. May I ask you why you would like to execute both updates within one statement? -- tesu | |
Re: Hi muppet Glad to meeting you again. How is Hayley Westenra doing? I didn't heard of any new song from her for some time past. I myself prefer her older po kare kare ana, also her interpretation of Kate Bush's Wuthering Heights is masterly performance. Of course, there is a … | |
Re: Hi andyjeans, glad to meet you again. [CODE]... SELECT Product2ID, 'Product2', [COLOR="Red"]c.ClientID[/COLOR], c.App1FirstName, c.App1LastName, c.App1Email,c.App1Phone, c.App2Email, c.App2Phone, p.clients_ClientID FROM clients c JOIN Product2 p on c.ClientID = p.clients_ClientID WHERE p.clients_ClientID IS NULL [COLOR="Red"]GROUP BY ClientID[/COLOR] ... [/CODE] This is again wrong. All database systems but one stringently refuse execution of … | |
Re: Hi You already have got this: [CODE]select name, country_code from city where population >= 5000000);[/CODE] If you omit "name", you get a country_code list with all countries having at least one city with pop. >= 5000000. [CODE]select distinct country_code from city where population >= 5000000);[/CODE] This list can be used … | |
Re: Hi what did you already do, are there any sql statements approaching the problem by yourself, tentatively in nature? -- tesu | |
Re: hi, decimal 12345 is hex [COLOR="Green"]0x00003039[/COLOR]. So to get a more practical example I changed: [CODE]character=*((char *)(&adad)+2); // 0x00 is stored[/CODE] to: [CODE]character=*((char *)(&adad)+1); // 0x30 is stored[/CODE] Assuming Intel processor, the assembly should look like: [CODE]lea ebx, adad ; address points to 0x39 (little Endian) add ebx, 1 ; … | |
Re: These union selects [CODE]select reason_right as "Reason", sum(scrap_right) as "Quantity" from bakma_table where "Reason" IS NOT NULL group by "Reason" union select reason_left as "Reason", sum(scrap_left) as "Quantity" from bakma_table where "Reason" IS NOT NULL group by "Reason" order by "Quantity" desc ;[/CODE] should give such a list [CODE]| Reason … | |
Re: Hehe what school you attend selecting from age range 30 to 35? After all you are still programming for hidden dating site, isn't it? Why not writing a simple query as for example: [CODE]select all_my_dating from mytables where YEAR(CURDATE()-DOB) between 30 and 35; [/CODE] Hint: Never store age of a … | |
Re: [CODE]Instead of: ... DB_INTERVAL_START < '11.78' AND DB_INTERVAL_END[COLOR="Red"] >=[/COLOR] '11.78' should it not be: ... DB_INTERVAL_START < '11.78' AND DB_INTERVAL_END [COLOR="Green"]<=[/COLOR] '1[COLOR="Green"]2[/COLOR].78' ? Sorry, wrong too or better: ... '1[COLOR="Green"]0[/COLOR].78' < DB_INTERVAL_START AND DB_INTERVAL_END [COLOR="Green"]<=[/COLOR] '1[COLOR="Green"]2[/COLOR].78' -- to get 5th line this works [/CODE] -- tesu | |
Re: If your given example means that table 1 has 3 rows where 1st row ID is 1, 2nd row id is 2 etc and table 2 has 8 rows (!) then you can apply simple inner join to get the result: [CODE]select some_rows_from_table1, some_from_table_2 from table1 a join table2 b … | |
Re: Hi who is OWNER of table user in: "select * from User" ? If dbo, then "select * from dbo.User" Aha, and not forgetting: "User" is a reserved keyword in SQL server which is not allowed to get redefined by you. Btw, there isn't any system table "User" which contains … | |
Re: Hi simply divide clock-result by clocks per second, and don't forget the cast: [CODE]double_difference=double((end-start)) / CLOCKS_PER_SEC;[/CODE] to get the correct seconds. -- tesu | |
Re: Hi don't worry, rows in database tables never have a particular order. This is a general rule for relational databases are based on set theory (at least as regard that). So if you want to get a certain order, you must make explicitly use of order function by [B]ORDER BY[/B] … | |
Re: Hello I am not sure whether even and odd series of row numbers could help: [CODE]select -1+2*row_number() over (order by ID1 ASC) as rownumber, 'First Set' as whichSet, colA as "Data" from rowTest union select 2*row_number() over (order by ID2 DESC) as rownumber, 'Second Set' as whichSet, colB as "Data" … | |
Re: Hi I am sure, you know that the precision and scale should be explicitely specified. If not, precision and scale of numeric and decimal DT are 10 and 0, that is default is decimal(10,0) or numeric(10,0). So numbers having decimal places will be automatically rounded. If you have money values, … | |
Re: C99 standard defines some erf() in math.h (not cmath). Unfortunately, MS C++ math.h doesn't have erf(). Maybe my little erf() once I posted [URL="http://www.daniweb.com/forums/thread294232.html"]here[/URL] can also help you. Sure, boost is the best. -- tesu | |
Re: Nice ERM :) Invoice against purchase of your customer is related to order. Your relationship –generates< is one-to-many which means that a certain order may have various invoices what is a good idea if your company is dealing with partial shipment. Here invoices usually have their own primary keys which … | |
Re: Hi Glad to meet a netbeans fan too. These problems leap to my eye: [CODE]PreparedStatement ps = conn.prepareStatement("INSERT INTO info VALUES (?,?,?,?,?)"); ps.setString(2, userInputname); ps.setString(3, userInputNIRC); ps.setString(4, userInputcontact); ps.setString(5, userInputemail); ps.setString(6, userInputl1r4); ps.execute(); -- The first ? is numbered 1, so the setters should be called with: ps.setString([B]1[/B], userInputname); ps.setString([B]2[/B], … | |
Re: Selamat siang, You are showing two tables jawab and kunci. Your select contains further tables: siswa in from clause and tabel_mk in where clause where the latter is missing in from clause. There is a further table tabel_jwb mentioned in your last question but one. So which tables are correct? … | |
Re: Hi I think it's a good idea to state a convenient example in the form of a data table and you may define "ranking" more precisely. (There are nice ranking functions in OLAP which has been offered by almost all databases since the ANSI SQL1999 standard.) -- tesu | |
Re: hi >>> A distribute places an order is this a customer? >>> distributor will be ranking based on their sales are order and sales identical? >>> An order can consist of many product... ERM looks like: distribute? ----< order ----< order_details/item >---- product (---< is crowfoot) where order_details is many-to-many … | |
Re: Hi This problem cannot be solved with one single sql select statement. You need some procedural code, e.g. programmed in PSM, C, Java or PHP. I would design a user defined function or stored procedure in PSM to carry out this task. The procedure may function that way: Given a … |
The End.