Jump to content

0o0o0

Members
  • Posts

    88
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

0o0o0's Achievements

Member

Member (2/5)

0

Reputation

  1. yep sql beats it hands down .. thanks all!
  2. your xy is kinda freaky.. 9 hours.. waiting otday.. and well. ya its half done once I sorted by name 5 mins lol.. but I still want the sql answer. ----- Hey thanks Jacques1!
  3. honestly... Im using excel and i5 laptop, and its all a P.O.S. I have 400,000 rows and i simply want all the names to have the number of games played at the end of every row... I started it at 8:30am.. its now 3:06pm... so I was messing around and threw the list into a database and its a hell of alot faster.. So my plan let sql do the calcs quicker.. export back to excel.. voilia. sorting simpler. but ah! since you asked me this.. maybe sorting the excel sheet by names then doing the calcs is faster.. thx. as for the question above im still looking for an answer.
  4. I have a table.. explain this as quick as I can.. ok .. you all know what this does correct? select playerref, count(playerref) as gamesplayed FROM contest group by playerref say I have 51 rows.. Joe is 50 of them. and 1 row is pete.. the above will return two rows as the result.. one joe 50 one pete 1 what im trying to do is keep all 51 rows.. but at the ends is a new column in all joes 50 rows, in this new column it shows 50 and the last row it shows one row pete 1 Basically I want the count in a new column at the end of every row. possible? thanks anyone who can help.
  5. well its pretty safe to say "Barand" has taught me everything I know in sql and php. thanks again!
  6. What does one use to make this from 2 weeks to 1 month ago? This is now till a month ago ( in days) WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH) How do you change NOW() to 14 days ago, INTERVAL 1 MONTH WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH) tried... - 14 14 DAY 14 DAYS - 14 ) NOW(-14) NOW() - 14 Nothing on the net i found in roughly 60 searches matched anything ive tried to do. So... basically find everything in the db from 14 days ago.. to 1 month ago. on going rolling day to day.. I mean everyday no solid dates used the query.. so in 14 days from now (MAR 4) it would show Feb 19 (todays entires) to jan 19th Thanks.
  7. lol can I just go into my plumbing table, and add a row.. that always inputs PLUMBING in that last row automatically. simply put, without all the yammer lol.... is it possible?
  8. Lets do this another way.. say you have 3 identically structured tables.. except ones for plumbing, ones for electrical ones for say carpentry now eventually you want to create another table called. ALL So you would dump table 1 (plumbing) table 2 (electrical) table 3 (carpentry) into ALL... by cron at the end of everyday in the future.. You would have a table with all the tables info, except no real understanding of which row is plumbing, electrical or carpentry. So .. what i trying to find on the net, which I havent found yet.. is every time I put an entry into plumbing.. i do the usual.. but is there a way to create something like what TIMESTAMP row does.. but its just the word "PLUMBING" automatically in a row.. when I hit save. In that table forever.. same for adding an entry into electrical, the last row ( I will add to all tables when I find out if this is capable) the last row will automatically enter ELECTRICAL. get me? I know I sound LAAAAAZY.. lol but eventually adding the word "plumbing" to the last row in plumbing table every single time.. tedious. So.. now down the road, I dump all 3 tables into ALL table.. and I can then grab all plumbing when needed or all electrical, or plumbing and electrical without carpentry etc etc.. Or am im outdated? and theres a way to dump tables and insert which table they came from in the process of dumping the three tables into the "ALL" table. ( im not using "ALL" as a table name, its just for explanation here) Even if I wanted to just spit out the entire all 3 databases on an webpage as it stands now.... they COULD say plumbing , electrical, carpentry on them.. but it still wouldnt have it in the last row in the tables.
  9. Two questions.. I have two tables.. one plumbing, one flooring. To see the list on a browser I created php and html.. all good. one for plumbing one for flooring. now today I want to COMBINE the two on one page.. so I did... but to the viewer they see a list and cannot tell whether a line is plumbing or flooring unless they read the details. I would like the ending to state PLUMBING, or to state FLOORING.. for quick reference. So the two questions.. how does one make a column in their table lets call it "Jobtype" to always add the word "PLUMBING " when an entry is inputted.. ( kind of like how timestamp stamps the time without any manual input) second question maybe easier than messing with my tables. If you had such setup like ive explained how would you php program to post PLUMBING if the line came from plumbing table, and post FLOORING if the next 2 lines were from flooring, and the next 4 lines say ( any number ) to post PLUMBING ... other than simply having $jobtype, if the tables werent done like question one. todays been pretty hazy so I came to the forums for a little brain wake up
  10. I had it right 3 hours ago... duh.. It was OUTSIDE the foreach limit on the page.... maaaaan anyhow thanks for the reply.
  11. Did this a long time ago, and forget hoe to do it today.. searched the net for an hour no answers.. In simple php dom parser I need the coding for getting the element or tags name.. <div class="at_result" source="1215" category="24980966"> like category ... I need 24980966 <--- need that number.. tried $item['ID'] = $article->find('category')->innertext; tried $item['ID'] = $article->find('category')->outertext; tried $item['ID'] = $article->find('category')->plaintext; tried $item['ID'] = $article->find('div.category')->plaintext; I forget whats needed. so it will parse out the "24980966" for me. anyone? next page could be <div class="at_result" source="1215" category="34382966"> etc etc.. thanks
  12. I have this below ive used it for a couple years.. $query = "SELECT * FROM `table` WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH) ORDER BY Date DESC"; Works great .. but I would like to add an ending date to it.. i've tried the below way and it works ...but I like how the above would dwindle down slowly to showing less and less information by the following month or set date.. $query = "SELECT * FROM `table` WHERE date BETWEEN '2015-06-19' AND '2015-08-01' ORDER BY Date DESC"; Need something added to WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH) (example stop showing anything after '2015-08-01' or set future date.) so the viewer slowly stops seeing june 19 tomorrow.. june 20 next day.. less and less... that by September 1st the user has to contact me by phone or email because they have nothing left to see. Thanks
  13. Just getting select statement 2 to attach to select statement 1 by Track and Race.. Select statement 2 will be the same numbers for all horses in each race, as they are the max figures of the entire race. I just need need em to join together lol.. its there! its soo close and I can figure out the structure of the code to do so. Select statement 1 ---> select statement 2 .. joined.. by CURDATE, Track, Race (basically the race number) and the desired result appears like.. TRACK CHURCHILL RACE1 HORSE1 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE2 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE3 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE4 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE5 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE1 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE2 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE3 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE4 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE5 STAT STAT STAT ( and joined here) Maxstat maxstat Maxstat how do ya do it? maybe if ripped down the code it wont be so confusing to read. SELECT t1.Horse, t1.Track, t1.Race, t1.Date, t2.win, t3.win2014 FROM champsintoday as t1 LEFT JOIN champshorses as t2 ON t1.HorseRef = t2.referenceNumber LEFT JOIN champshorses2014 as t3 ON t1.HorseRef = t3.referenceNumber2014 WHERE t1.Date = CURDATE() ORDER BY t1.Date ASC, t1.track ASC, t1.Race ASC, t2.win DESC and put this on the end.. SELECT t1.Track, t1.Race, MAX(t2.win) AS maxwin2015, MAX(t3.win) AS maxwin2014MAX FROM champsintoday as t1 LEFT JOIN champshorses as t2 ON t1.HorseRef = t2.referenceNumber LEFT JOIN champshorses2014 as t3 ON t1.HorseRef = t3.referenceNumber2014 WHERE t1.Date = CURDATE() GROUP BY t1.Date, t1.track, t1.Race ORDER BY t1.Date ASC, t1.track ASC, t1.Race ASC, t2.win DESC TRACK CHURCHILL RACE1 HORSE1 1 (win) 1 (win2014) ( and joined here) 7 (maxwin2015 col) 6 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE2 3 (win) 1 (win2014) ( and joined here) 7 (maxwin2015 col) 6 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE3 1 (win) 6 (win2014) ( and joined here) 7 (maxwin2015 col) 6 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE4 7 (win) 1 (win2014) ( and joined here) 7 (maxwin2015 col) 6 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE5 1 (win) 1 (win2014) ( and joined here) 7 (maxwin2015 col) 6 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE1 2 (win) 3 (win2014) ( and joined here) 9 (maxwin2015 col) 8 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE2 7 (win) 5 (win2014) ( and joined here) 9 (maxwin2015 col) 8 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE3 6 (win) 8 (win2014) ( and joined here) 9 (maxwin2015 col) 8 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE4 9 (win) 1 (win2014) ( and joined here) 9 (maxwin2015 col) 8 (maxwin2014 col) TRACK CHURCHILL RACE1 HORSE5 1 (win) 3 (win2014) ( and joined here) 9 (maxwin2015 col) 8 (maxwin2014 col) ( dont worry if two max numbers are the same, in the highlighting I want to do later it will highlight both horses cause their stat for win or win2015 will equal the Maxwin number col) anyone understand what im trying to achieve?? or am I still not clear? please lemme know its hard to talk sql when your not all that experienced at it. UNION was advised to me, but im still thinking JOIN.. considering the columns are not the same for UNION. I really dont know. thanks for everyones time involved so far.
×
×
  • 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.