Jump to content

684425

Members
  • Content Count

    62
  • Joined

  • Last visited

Community Reputation

0 Neutral

About 684425

  • Rank
    Regular Member
  1. I was trying it with a subquery and got confused. Thank you πŸ™‚
  2. I have a column (unix_values) in table where multiple values are stored in unix timestamp which i want to convert into date yyyy-mm-dd and copy to another column (date_values) using single query Any help please?
  3. Agree with you sir but the problem here is that DB is already created and filled with data. I tried to move data to a new DB and i was discussing the matter here. In the middle i was stopped from doing this, so i have to continue with the old one. Here in my first post i pasted a sample of only those fields on which i wanted to run queries like as query total amounts paid by each customer, find number of customers whose total payments are (1. less than given input, 2. equal to given input, 3. greater than given input) What i am facing here is, old DB is not normalized, also (dynamic?) values calculated from other values are stored in tables (the exact term for calculated is slipped from my mind) The image in this reply is corrected one (in my opinion, not in the DB i am working on) Here invoices.id is primary key in invoices table and installments.invoiceid id foreign key in installments table. i created these two tables (invoices and installments) and inserted exactly same data, then ran the following query and it worked. I just wanted to confirm that, is this query correct for any situation limited to these two tables? or is there something that i missed? SELECT invoices.invoice, invoices.downpay, SUM(installments.payments) AS paid FROM invoices LEFT JOIN installments ON invoices.id = installments.invoiceid GROUP BY invoices.id I also want to apologize. I am very sorry for creating this mess and confusing all of you. I hope that i will be forgiven by all the contributors who tried to help me here.
  4. 1. You are right sir. this column should be named as customerid but it is named as invoice and i am not allowed to change it. 2. There is only one duplicate in history data but that account is closed. After that every customer is assigned a unique invoice.
  5. Sir, i have reached at this SELECT customers.invoice, customers.downpay, SUM(installments.payments) AS paid FROM customers LEFT JOIN installments ON customers.id = installments.invoices GROUP BY customers.id Please guide me if i am wrong
  6. Sorry sir, it is... TableA is customers (id, invoice, downpay) TableB is installments (id, invoices, payments) TableC is the result of query that i want to run on both customers and installments Sir i am not allowed to modify DB structure and i do not want to do that because it already is filled with lots of records. I can run only queries on data.
  7. In another query i will need to repeat the same and then also i will have to count records from result where BBB + CCC = 10000. Please guide meπŸ™‚
  8. I have two tables as shown in image, I want to join sum of records from table B based on keys in both tables to get the desired result as mentioned in third table. Please guideπŸ™‚
  9. I have added an image, User requirements are: Vendors, items by vendors and payments to vendors How many vendors are there? Which vendor has sold him what on which date (and what is the status of registration, file, copy and plates)? How much amount (each transaction by date) has been paid to a specific vendor and what is the current balance? Clients, items by invoice number and payments collection from clients Which client has bought of which vendor's item on which date? Who handled the client, filled the form and received advance from client? (There are three persons, user, his father, his brother. Form filling and advance receiving must be done by the same person) Which client has paid all the amount? (in full or in parts) the status must be shown as cleared for this category Which client is still paying installments? (is he/she paying on time or not? if yes then status shown as pending else defaulter) If a mistake by one of those who handle clients, is found then status should be as error Daily, weekly, monthly, yearly etc summary of collected payments can be generated (I may have missed something, i will add it later. Also i will try to complete database structure and upload soon IA)
  10. No sir, A are the companies (always sellers), C are individuals (always buyers) Agree sir, I am confused in both database structure and frontend, so i added this. But it is not added now. Currently i am working on Excel, i will post screenshots tonight in next reply IA.
  11. Sir, this is only for bikes. I am sorry i forgot to mention it in my post.
  12. Sir, I think it is... 1. Vendors table (vendor ID, name, contact) 2. Items table: (Item ID, invoice number 'varchar', Here every item is a bike 'varchar', different brands but duplicates 'varchar', different models but duplicates 'year', only two colors mostly red so duplicates 'varchar', engine number unique 'int', chasis number unique 'int', registration number unique 'varchar', statuses of registration, file, copy and plates are as 1 of 3 or 1 of 4 choices (radio buttons will be used on frontend), deal date 'date', delivery date 'date' 3. purchase table: (vendor ID, item ID, cost (separate for each bike)) 4. payments (to vendor) table: (ID, vendor ID, payment amount, payment date, paid by) 5. Clients table: (ID, name, ID card number, contact number) 6. Sales (to clients) table: (ID, vendor ID, item ID, invoice number (not blank in this table but one record in history data is duplicate), date of buying, price, advance, paid to, total paid (including installments), total balance) 7. installments (from clients) table: (ID, sale ID, amount per month, paid amount (can be less, equal or more than per month), remaining (can be less than, equal to or greater than zero), payment month (on which it was to be paid), payment date, paid to) I am trying hard to make a database, compatible with manual data and old database too (old database contains errors but my friend is satisfied with it as it is the exact copy of his manual data) but on the other side i want to do things the right way (i think the fields in each table are not as they should be)
  13. I am working on a database (filled with history data) for the following, Person A is running a business as a third party between multiple sellers B and multiple buyers C 1) A purchases bikes from B and maintains the following data: "Invoice ID of C (or blank), Name of B" , "Bike brand, model(year), color(red or black), engine number, chasis number, registration number, registration status (1 of 3 posibilities), file status (1 of 4 posibilities), copy status (1 of 4 posibilities), number plates status (1 of 4 posibilities), price, deal date, delivery date" 2) A sells bikes to C in installments and maintains the following data: "Invoice ID (not blank but one duplicate found in history data), Name of C, contact number, ID card number", "Deal date, Price, advance, advance taken by, remaining amount after advance", "Installment number, collection month, date on which it was collected, collected by, total collected amount including advance, total balance amount" I was given this task from point number 2 but after facing problems specially in expenses and balance sheet. now i have to start from zero. The idea that (in my opinion) suits the above is, 1. Vendors table 2. Items table 3. purchase table 4. payments (to vendor) table 5. Clients table 6. Sales (to clients) table 7. installments (from clients) table But the problem i am facing is that i am failed to distribute the above fields between these tables. Please guide me if i am wrong at some point
  14. i forgot to answer this. Most of the queries in the project execute at the time of page load and these pages display expected data accurately that comes from the database. The session variable error that i am getting is coming from one page only but that page too is displaying exactly the same data which is stored in database. PS: Right after my previous reply, I did wrap my code in a condition to confirm that the session variable is set or not and used a redirect if it is not set. Php redirected me to the other page and told that the variable is not set. The other mistake that i have found is that i was setting one session variable with same name twice on two different pages. (First page is storing an array of lets say three elements ABC in a session variable and the other page is storing an array of "Those three elements" ABC "again with three more elements" DEF in the same session variable)
  15. Thank you Sir for this detailed answer and your advice. I had a doubt that i was going wrong somewhere in this project but each of your word is telling me that i should study php more because there is a bunch mistakes in my code (but i am really surprised that the code is still working as expected. Sorry about repeating this again) (i am not a proper literate in programming because computer science or programming was not my subject in school and i was unable to continue my studies due to more than ten years of unemployment. its just that i am crazy about learning it. your reply has told me that i am not ready yet for working as a programmer, even for my own experiments like this one. programming is not my profession, it is my craze) Thanks to all of the experts on this forum for guiding me and others too. i am sure that your guidance will improve my knowledge πŸ™‚
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.