Jump to content

0o0o0

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by 0o0o0

  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.
  14. I guess the "ORDER BY t1.Date ASC, t1.track ASC, t1.Race ASC, t2.speedFigure DESC" wont be needed in both. Is this simple? am i over looking it? Im worried about the replies already. Thanks guys.
  15. Ok i think im over my head, ive come to a brick wall, and usually when this happens a reply of the simpliest form comes back. I might be thinking to hard.. here it goes.. Table ONE champshorses2014 stats will always stay the same. Table TWO champshorses is updated everyday from the source. Table THREE horsesintoday is updated daily three times a day. basically I have created two SELECT statements and all im really trying to figure out is how to merge the two together properly so the final out put would appear as so... TRACK CHURCHILL RACE1 HORSE1 STAT STAT STAT ( and joined here) (same R1) Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE2 STAT STAT STAT ( and joined here) (same R1)Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE3 STAT STAT STAT ( and joined here) (same R1)Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE4 STAT STAT STAT ( and joined here) (same R1)Maxstat maxstat Maxstat TRACK CHURCHILL RACE1 HORSE5 STAT STAT STAT ( and joined here) (same R1)Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE1 STAT STAT STAT ( and joined here) (same R2)Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE2 STAT STAT STAT ( and joined here) (sameR2)Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE3 STAT STAT STAT ( and joined here) (sameR2)Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE4 STAT STAT STAT ( and joined here) (sameR2)Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 HORSE5 STAT STAT STAT ( and joined here) (sameR2)Maxstat maxstat Maxstat even tho all the MAX STATS at the ends are the same max numbers, of each Track, Race number group.. doesnt matter.. I need these merged to print out or return as above in single lines.. Basically im not knowledgeable of joining, left join, inner join or merge, or what is needed to mash these two select statements together as one. I have TRACK CHURCHILL RACE1 HORSE1 STAT STAT STAT TRACK CHURCHILL RACE1 HORSE2 STAT STAT STAT TRACK CHURCHILL RACE1 HORSE3 STAT STAT STAT TRACK CHURCHILL RACE1 HORSE4 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE1 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE2 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE3 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE4 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE5 STAT STAT STAT with the first code.. and TRACK CHURCHILL RACE1 Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 Maxstat maxstat Maxstat TRACK CHURCHILL RACE3 Maxstat maxstat Maxstat TRACK CHURCHILL RACE4 Maxstat maxstat Maxstat TRACK CHURCHILL RACE5 Maxstat maxstat Maxstat TRACK CHURCHILL RACE6 Maxstat maxstat Maxstat with the second code.. need em mashed.. to appear like so... 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 So Maxstats at ends will be the numbers in select statement two I posted below.. Actually it should appear like this when done... TRACK CHURCHILL RACE1 HORSE1 STAT STAT STAT ( and joined here) 24 36 5000 TRACK CHURCHILL RACE1 HORSE2 STAT STAT STAT ( and joined here) 24 36 5000 TRACK CHURCHILL RACE1 HORSE3 STAT STAT STAT ( and joined here) 24 36 5000 TRACK CHURCHILL RACE1 HORSE4 STAT STAT STAT ( and joined here) 24 36 5000 TRACK CHURCHILL RACE1 HORSE5 STAT STAT STAT ( and joined here) 24 36 5000 even tho they are the same numbers.. the 24 could be from horse 1 first stat as highest, and 36 from horse 5 second stat highest, and horse 3 has the hiighest last stat, doesnt matter theur added to all the ends.. whatever works.. then in php I will just simply do a php if statement.. if ($t1.Track = $t4.Track and $t1.Race = $4t.Race And $t2.rank = $t4.maxrank) $col14 = "#006600"; if ($t1.Track = $t4.Track and $t1.Race = $4t.Race And $t3.rank2014 = $t4.maxrank2014) $col14 = "#006600"; etc.. through out. something like that.. but probably dont need the t2.t3.t4. as they will be rank rank2014 and maxrank maxrank2014 anyhow.. dont worry about this this I can do later. just need the two mashed lol. Code 1 appears something like this when executed.. TRACK CHURCHILL RACE1 HORSE1 STAT STAT STAT TRACK CHURCHILL RACE1 HORSE2 STAT STAT STAT TRACK CHURCHILL RACE1 HORSE3 STAT STAT STAT TRACK CHURCHILL RACE1 HORSE4 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE1 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE2 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE3 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE4 STAT STAT STAT TRACK CHURCHILL RACE2 HORSE5 STAT STAT STAT Select statement 1: SELECT t1.Horse, t1.Track, t1.Race, t1.Jockey, t1.Trainer, t1.Owner, t1.Date, t2.speedFigure, t2.rank, t2.perStart, t2.topThree, t2.topThreePercentage, t2.winPercentage, t2.starts, t2.win, t2.place, t2.show, t2.earnings, t3.speedFigure2014, t3.rank2014, t3.perStart2014, t3.topThree2014, t3.topThreePercentage2014, t3.winPercentage2014, t3.starts2014, t3.win2014, t3.place2014, t3.show2014, t3.earnings2014, (t2.speedFigure + t3.speedFigure2014) AS figtote, (t2.rank + t3.rank2014) AS ranktote, (t2.perStart + t3.perStart2014) AS avgtote, (t2.topThree + t3.topThree2014) AS pronum, (t2.topThreePercentage + t3.topThreePercentage2014) AS pronumpercent 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.speedFigure DESC Statement 2 this grabs only the maxs figures of all horses in each race at each track, single lines like so.. TRACK CHURCHILL RACE1 Maxstat maxstat Maxstat TRACK CHURCHILL RACE2 Maxstat maxstat Maxstat TRACK CHURCHILL RACE3 Maxstat maxstat Maxstat TRACK CHURCHILL RACE4 Maxstat maxstat Maxstat TRACK CHURCHILL RACE5 Maxstat maxstat Maxstat TRACK CHURCHILL RACE6 Maxstat maxstat Maxstat Select statement two: SELECT t1.Track, t1.Race, MAX(t2.speedFigure) AS maxf2015, MAX(t3.speedFigure2014) AS maxf2014, MIN(t2.rank) AS maxr2015, MIN(t3.rank2014) AS maxr2014, MAX(t2.perStart) AS maxa2015, MAX(t3.perStart2014) AS maxa2014, MAX(t2.speedFigure + t3.speedFigure2014) AS maxtoprating, MIN(t2.rank + t3.rank2014) AS maxtoprank, MAX(t2.perStart + t3.perStart2014) AS maxtopavg, MAX(t2.starts) as maxstarts, MAX(t2.winPercentage) as maxwinPercentage, MAX(t2.topThreePercentage) as maxtopThreePercentage, MAX(t2.win) as maxwin, MAX(t2.place) as maxplace, MAX(t2.show) as maxshow,MAX(t2.topThree) as maxtopThree,MAX(t2.earnings) as maxearnings, MAX(t3.starts2014) as maxstarts2014, MAX(t3.winPercentage2014) as maxwinPercentage2014, MAX(t3.topThreePercentage2014) as maxtopThreePercentage2014, MAX(t3.win2014) as maxwin2014, MAX(t3.place2014) as maxplace2014,MAX(t3.show2014) as maxshow2014, MAX(t3.topThree2014) as maxtopThree2014,MAX(t3.earnings2014) as maxearnings2014, MAX(t2.topThree + t3.topThree2014) AS maxpronum, MAX(t2.topThreePercentage + t3.topThreePercentage2014) AS maxpronumpercent,(t2.speedFigure + t3.speedFigure2014) AS maxfigtote, (t2.rank + t3.rank2014) AS maxranktote, (t2.perStart + t3.perStart2014) AS maxavgtote 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.speedFigure DESC im just clueless as to what I need... join? left join? where to put brackets, or whatever is needed to make these two codes spit out single full figure lines. If I told ya how many attempts and weeks hours its taken to get these two together in one statement youd probably laugh.. lets just say every day for a few hours since june 22nd. lol.. meanwhile working around it and adding to it, but cannot for the life of me place the two together into one properly. This is a personal hobby, not a job or commercial project, just basically mine that opens once in a browser and stays on my laptop for a day during the weekend.. So loading time, efficency or spaghetti coding is not an issue, and help is great as long as it works. lol! thanks.
  16. correction the if statement would probably look like. if ($t1.Track = $t4.Track AND $t1.Race = 4t.Race AND $t2.rank = $t4.maxrank) $rankcolumn = "#006600"; doesnt matter.. just looking for how to mash the two Selects together with sql.. I can figure out the php code after.
  17. k here we go, been workin on this for a long time.. lol.. for me anyhow.. you guys probably would take 4 mins. this below gives me all the races, all the horses in each race.. and stats.. SELECT t1.Horse, t1.Track, t1.Race, t1.Jockey, t1.Trainer, t1.Owner, t1.Date, t2.speedFigure, t2.rank, t2.perStart, t2.topThree, t2.topThreePercentage, t2.winPercentage, t2.starts, t2.win, t2.place, t2.show, t2.earnings, t3.speedFigure2014, t3.rank2014, t3.perStart2014, t3.topThree2014, t3.topThreePercentage2014, t3.winPercentage2014, t3.starts2014, t3.win2014, t3.place2014, t3.show2014, t3.earnings2014, (t2.speedFigure + t3.speedFigure2014) AS figtote, (t2.rank + t3.rank2014) AS ranktote, (t2.perStart + t3.perStart2014) AS avgtote, (t2.topThree + t3.topThree2014) AS pronum, (t2.topThreePercentage + t3.topThreePercentage2014) AS pronumpercent 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.speedFigure DESC small example Race 1 horse 1 stat stat stat Race 1 horse 2 stat stat stat Race 1 horse 3 stat stat stat Race 1 horse 4 stat stat stat Race 2 horse 1 stat stat stat Race 2 horse 2 stat stat stat Race 2 horse 3 stat stat stat Race 2 horse 4 stat stat stat all good... now this below gives me all the "highest" numbers for each race.. SELECT t1.Track, t1.Race, MAX(t2.speedFigure) AS maxf2015, MAX(t3.speedFigure2014) AS maxf2014, MIN(t2.rank) AS maxr2015, MIN(t3.rank2014) AS maxr2014, MAX(t2.perStart) AS maxa2015, MAX(t3.perStart2014) AS maxa2014, MAX(t2.speedFigure + t3.speedFigure2014) AS maxtoprating, MIN(t2.rank + t3.rank2014) AS maxtoprank, MAX(t2.perStart + t3.perStart2014) AS maxtopavg, MAX(t2.starts) as maxstarts, MAX(t2.winPercentage) as maxwinPercentage, MAX(t2.topThreePercentage) as maxtopThreePercentage, MAX(t2.win) as maxwin, MAX(t2.place) as maxplace, MAX(t2.show) as maxshow,MAX(t2.topThree) as maxtopThree,MAX(t2.earnings) as maxearnings, MAX(t3.starts2014) as maxstarts2014, MAX(t3.winPercentage2014) as maxwinPercentage2014, MAX(t3.topThreePercentage2014) as maxtopThreePercentage2014, MAX(t3.win2014) as maxwin2014, MAX(t3.place2014) as maxplace2014,MAX(t3.show2014) as maxshow2014, MAX(t3.topThree2014) as maxtopThree2014,MAX(t3.earnings2014) as maxearnings2014, MAX(t2.topThree + t3.topThree2014) AS maxpronum, MAX(t2.topThreePercentage + t3.topThreePercentage2014) AS maxpronumpercent,(t2.speedFigure + t3.speedFigure2014) AS maxfigtote, (t2.rank + t3.rank2014) AS maxranktote, (t2.perStart + t3.perStart2014) AS maxavgtote 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.speedFigure DESC Now I have all horses all races.. and the other code I have all the MAX's for each race.. the idea is to show all horses all races.. and in php whichever matches those max numbers it highlights. That parts easy I can figure that out.. My question is .. instead of making the second code just goto a mysql table.. is there such thing as an "imaginary, or temporary invisible table??? Basically mashing the two above to be all in one select line..???? i just dont have a clue how to put both above together to make say... race 1 horse 1 stat stat stat maxstat, maxstat, maxstat.. or even if statement .. if ($Track = $t4.Track and $Race = 4t.Race And $rank = $maxrank) $col14 = "#006600"; etc.. through out. basically how does one mash the above together and create a temp table for the second Select code. thanks to anyone who can give me a suggestion.. its a lot of code ( i think) even if you cut it down and show me a simple example not using all the code I have.. lemme know. been stuck here trying endless attempts and getting errors for .... checking first post ...holy s**T!! an hour a day for 3 weeks now.. lol blush. Thanks to anyone. This is personal project, not commercial or for any client, just a hobby thing.. so any shoe string suggestions welcome also lol speed doesnt matter, nor efficiency.. its personal if it takes 60 seconds+ to load no biggie. Its only to load a page once and leave it in a browser, on my screen for the entire day.
  18. that just leaves one row. so like say race 1.. it leaves horse number 8 but not horse 7 6 5 4 3 2 1 I just need to to be $speed so I can php <td><?php echo ($row['speed'] == $max['speed']) ? "<strong>{$row['speed']}</strong>" : $row['speed']; ?></td> but its not workin out
  19. example... http://www.e-ponies.com/races/california-free-horse-racing-picks.htm Just an example of what this would look like below.. SELECT t1.Horse, t1.Track, t1.Race, t2.Speed, t2.Class, t2.Form, t2.Last, t2.Conn, t2.Line, t2.win, t2.Total FROM racestoday as t1 LEFT JOIN horses as t2 ON t1.HorseRef = t2.HorseRef WHERE t1.Date = CURDATE() ORDER BY t1.Date ASC, t1.track ASC, t1.Race ASC It would list them perfectly liek the example link above.. but how do you get all the highest in bold??.. and how they bold each race for each track and Speed, Class, Form,Conn, and Total? Is this Group by? when I try group by I only get one row from track race 1, track race 2, track race 3.. but how do you get all? Any help would be great! Each Track by Each race with "all" horses listed and just ONE example of how to bold the highest in a list. Not order, but highlight or bold. Am I going in the wrong direction here with mysql? is it in php coding?? or mysql or both?? Thanks for any replies.
  20. Its ok figured it out.. I'll leave it here for whoever else is looking for the same. ( its not really for fruit lol) $query = "SELECT t1.Fruitname, t2.Fruitcount, t3.Fruitcount FROM tableA as t1 LEFT JOIN tableB as t2 ON t1.id = t2.id LEFT JOIN tableC as t3 ON t1.id = t3.id AND t1.Date = CURDATE() ORDER BY t1.Date ASC";
  21. TABLE A TABLE B TABLE C FRUIT ID FRUIT ID COUNT FRUIT ID COUNT APPLES 1 STAND 1 APPLES 1 10 STAND 2 APPLES 1 20 GRAPES 2 STAND 1 GRAPES 2 10 PEARS 3 STAND 2 PEARS 3 30 ORANGES 4 STAND 1 ORANGES 4 30 STAND 2 ORANGES 4 Looking for a result like so.. APPLES STAND 1 10 STAND2 20 GRAPES STAND 1 10 STAND2 PEARS STAND 1 STAND2 30 ORANGES STAND 1 4 STAND2 Table A holds all the items none missing ever. Then matches ID with TABLE A ( the most important table) then TABLE C ( second most important) to spit out the above I was messing around with LEFT JOINS and RIGHT JOINS then found LEFT OUTER JOIN.. and in SQL box tested some coding that well.... went infinate and the first time in 10 years had to call my hosting to stop it. .....or.... it finally ran its course 3 days later and I dont know if they did really fix anything. Anyhow I figured Id post here to get some help before really hurting the hosting companies server. $query = "SELECT * FROM `TABLEA`, `TABLEB` WHERE TABLEA.ID = TABLEB.ID AND TABLE.Date = CURDATE() ORDER BY TABLEA.Date ASC"; ( Lets just assume theres a date column in tablea as well) I need to successfully and "safely" add table c without throwin it into a infinity loop lol... Thanks.
  22. I know im very lazy today, I did 7 searches no direct answer.. $own = "#FFFFFF"; if ($Owner == 'Ryan O'neill') $own = "#00FF00"; ** how does one use the ' in O'neill as the name and not get mistaken for ending in code? is it /' or /*' or ?? outta guesses. Thanks.
×
×
  • 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.