Jump to content

Recommended Posts

Can you help me out guys? I now need to compare a previous price with a current one and the problem is when I compare Dec with January of a next year. (I can't do this with PHP because I need the result of this query to make another query).

 

Let's say I want to compare these two rows (even if it's not just these two rows, it should check in the whole table):

 

ID,            year,  Jan ............(months)............., Dec

40432329, 2011, .............................................45.32

40432329, 2012, 28.45.............................................

 

 

How do I select all IDs where Jan 2012 is LESS than Dec 2010? Remember that on most months it will compare to same row, for example Sep 2011 with Oct 2011.

Tried with subquery but it said subquery returned multiple results. Help!

Link to comment
https://forums.phpfreaks.com/topic/236723-joining-subqueries/#findComment-1216996
Share on other sites

You, sir, shouldn't be on these forums, you can't help out anyway just giving people useless replies. I said I had one price in every cell, what is it you don't understand? Anyway I solved it myself. And if I would want more than one price in a cell I would separate them with a delimiter. Don't tell me how to build tables, fenway.

Link to comment
https://forums.phpfreaks.com/topic/236723-joining-subqueries/#findComment-1218398
Share on other sites

Just because his reply isn't the one you wanted to hear, doesn't make it useless. Especially since he's right. You're attempting to force a relational database to behave as a spreadsheet, which it is not.

Link to comment
https://forums.phpfreaks.com/topic/236723-joining-subqueries/#findComment-1218436
Share on other sites

You, sir, shouldn't be on these forums, you can't help out anyway just giving people useless replies. I said I had one price in every cell, what is it you don't understand? Anyway I solved it myself. And if I would want more than one price in a cell I would separate them with a delimiter. Don't tell me how to build tables, fenway.

Well, you don't know how to "build tables" -- so someone should tell you before you break something.  I really hope you're not being paid for this work, since you're about to screw over your client.  What you consider 'solved' everyone else in the world considers "broken".

 

And don't tell me how to help -- I can't tell you how to listen.

Link to comment
https://forums.phpfreaks.com/topic/236723-joining-subqueries/#findComment-1218666
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.