| |
| |
| |
|
Page: 1 2 3
Comments:
<0> you'll want a grouped sum <1> oh yeah <1> **** it's hot here <2> burn baby burn <3> hi <3> any1 know where i can buy cheap domain names ? <4> Zenethian: grouped sum? I have feilds (session_id, product_id) I want to see the which product_id was the most frequent. Is there a better way other than looping through each product? <0> yes <0> use a grouped sum. <0> lookup SUM() and GROUP BY <4> kk <4> no I dont think SUM is the right command <0> Why? <4> I want to count it, not sum it up <0> Oh <0> right, I see
<0> COUNT() .:) <4> and group by wouldnt count it either <4> but if I use count, that means I have to loop through 500 products and do a count query on each... <4> that takes long <0> um <0> no you don't <4> which is no good <0> use group by and count together. <4> hmmm... <4> can I order DESC by count <0> yes <4> Zenethian: i can't seem to figure out how to put this query together, think you can help? <0> sure <1> select COUNT(product_id) <4> SELECT * FROM product_tracker COUNT (product_id) GROUP BY (product_id); <1> well, there would be more <4> i think that would be good but if I group it, wouldnt it give me a coutn of 1 for every product? <1> SELECT * FROM product_tracker COUNT(product_id) AS Count GROUP BY (product_id) ORDER BY `Count` desc; <4> SELECT * FROM product_tracker COUNT (product_id) GROUP BY (product_id) ORDER BY COUNT DESC??? <1> serious, yeah, but you'd have to name it AS <0> SELECT COUNT(product_id) FROM your_table GROUP BY product_id ORDER BY COUNT(product_id) DESC <0> not * <4> ok thanks <0> probably more useful: SELECT product_id, COUNT(product_id) FROM your_table GROUP BY product_id ORDER BY COUNT(product_id) DESC <4> Im getting a weird error says Warning: mysql_query(): 4 is not a valid MySQL-Link resource in <5> hey all <5> what's crackin? <4> $get_models = mysql_query("SELECT COUNT(model_id) FROM track_models GROUP BY model_id ORDER BY COUNT(model_id) DESC LIMIT 15", $this->conn) or die(mysql_error()); <4> there is no 4 in there anywhere <5> why are you grouping if you are using count? <5> hmm, I think I see <4> because i thought it was the right thing to do <4> but where does this 4 come from? <5> well, the order by count(model_id) doesn't make sense <5> select count(model_id) from track_models order by model_id desc limit 15, sounds better <5> but then, you're going to get 15 of them <5> so, I don't get the 'limit' unless you have a where clause in there <6> $this->conn is what it's expecting to be a "link resource" <4> I know <4> but it works on all other functions of the page <6> so check it and see if it says 4? <4> why not this one? and what 4? <6> apparently it's getting a value of 4 instead of a link resource <4> its impossible <4> http://www.nomorepasting.com/paste.php?pasteID=65655 <4> look for yourself, it cannot possibly be set to 4 <7> mmm, so nice having a dual xeon, dual core server. compiles go really really fast :) <4> any ideas? <4> if I echo it says: Resource id #4 <1> serius_chronic, what's the line <1> it's probably an "echo mysql_query($query);" <1> or something like that <1> you really should read the tutorial on mysql with php <5> hey babble <1> hey cv <1> how ya been? <5> good <5> and you ? <7> ****, i dont see a binary version of the php yaz extension for php5 anywhere. <5> hey, you ever work on that admin site you were talking about? <4> the line is 43 that has the problem, I did an echo before the query of the mysql link resource
<4> Link-resource: Resource id #4 <5> what are you echoing? <5> oh <4> $this->conn <4> link-resource <5> err... what's going on? you're not refering to the correct resource id? <4> I am though <5> but it's not <5> is the problem? <5> just trying to get up to spead here before I start to read your code <5> where are you calling 'popular_models()' ? <4> in another page all together <4> why? <5> well, as far as I can see, the cl*** should refer to the resource id created in the constructor <5> so, I wanted to peep the rest of it <4> peep? <5> yes <4> umm what do you mean peep <5> look at <5> see <5> review <4> oh ok <0> create_vibe: that doesn't work. <5> peep <5> what doesn't work? <0> The original query I gave him works just fine <0> oh sorry, scrolling up <0> lol <0> nevermind. <4> it should but it complains bout the link resource <5> well, if I knew you showed him the query, I would not have suggested otherwise. you da man, Zenethian <0> SELECT product_id, COUNT(product_id) FROM your_table GROUP BY product_id ORDER BY COUNT(product_id) DESC <5> that makes better sense <5> than what he showed <5> but shouldn't you do... <5> select product_id, count(product_id) as something from your_table group by product_id order by something desc <5> ? <0> you can <5> I mean as far as efficiency? <5> would it not count twice? <0> there is nothing gained <0> it already knows what you're talking about <5> ahh, it's smart like that <0> COUNT (product_id) in the ORDER BY is a column name, not an aggregate function <5> ahh <5> didn't know that <0> jah <2> rhutabega <4> should this work? <4> "SELECT models.*, COUNT(track_models.model_id) FROM track_models INNER JOIN models ON track_models.model_id = models.model_id GROUP BY track_models.model_id ORDER BY COUNT(track_models.model_id) DESC LIMIT 15" <4> im getting confused... <0> no <0> you can't select * <0> ever <0> on a grouped query <0> you can only select columns you're grouping on. <0> it makes no sense to select * <0> the whole point is to collate the rows down into compacted values. <4> well i got it working, thank you all <0> =) <7> ugh, i hate doing ILS stuff <7> ILS = integrated library system <0> heh <0> well don't use it then. <0> duh <8> hi all <9> argh. <9> APPLY DIRECTLY TO THE FOREHEAD! <9> that's the most traumatic commercial I've ever seen <8> who knows about phpbb2 ? <9> rtft <9> and go in peace.
Return to
#php or Go to some related
logs:
#kl warmech irc #india #kl #vb #allnitecafe #chat-world #linux follatio #allnitecafe
|
|