Jump to content

Ujj

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.uberebayshopdesign.com/

Profile Information

  • Gender
    Not Telling

Ujj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ujj

    is this possible

    Hi keith, thank you very very much for the reply this what i was exactly looking but only one bit missing is the MinPrice (SELECT track_item_id, MIN(price) AS MinPrice FROM item_detail GROUP BY track_item_id) should exclude user_item.
  2. Ujj

    is this possible

    any suggestion, idea for this please
  3. Ujj

    is this possible

    thank you very much for the reply but i am looking for some different result first i am pulling the detail of lowest prices item form item_detail grouped by tracked_item_id and then price of user_item to compare with that; currently i am using two queries to achieve this, but i want to reduce it into one query.
  4. Ujj

    is this possible

    what is wrong in this query can you point it out for me please? select price as myprice from item_detail where itemID=a.user_item
  5. Ujj

    is this possible

    yes something is wrong or something i don't know and i am looking for the answer
  6. Ujj

    is this possible

    any idea why its incomplete? do you mean the missing table (select price as myprice from item_detail where itemID=a.user_item ) if yes; i tried this as well
  7. Ujj

    is this possible

    yes #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where itemID=a.user_item) from tracked_item as a left join item_detail as b on' at line 1
  8. Ujj

    is this possible

    i am pulling b.price as totalPrice ,b.track_item_id from table b , a.user_item from table a and and based on a.user_item on table a trying to pull price from table b related to that a.user_item from single query.
  9. Hello,just a quick question, it might be stupid one is there any alternative to do same ? SELECT b.price as totalPrice ,b.track_item_id , a.user_item , (select price as myprice where itemID=a.user_item) from tracked_item as a left join item_detail as b on b.track_item_id=a.id WHERE itemStatus='Active' AND b.user_id='$uid' GROUP BY b.track_item_id
  10. i tried but no success as I need to run this query for every user_item with condition where track_item IN.
  11. Hi again, being obsessed with removing queries from loop to optimize my code as suggested, here is my a situation i am stuck while trying to avoid query inside loop this is my t_item table and this is item_detail now i am running query like this to find out the lowest priced item from each track_item row of table t_item of each user_item of table t_item. after that i also need to find out price for each user_item of t_item table.. $sqlAdjustPrice = "select * from t_item where `user_id` = 63"; $rst=mysql_query($sqlAdjustPrice); while($row1=mysql_fetch_array($rst)) { $myItem = $row1['user_item']; $trackedItem = $row1['track_item']; $adjustPrice = $row1['adjust_price']; $groupID = $row1['g_id']; if($adjustPrice=='y') { $sql = "SELECT price FROM item_detail WHERE itemID in ($trackedItem) AND groupID='6' ORDER BY price asc LIMIT 1"; $rs=mysql_query($sql); $row = mysql_fetch_array($rs); $lowestPricedTrackedItem = round($row['price'],2); $sql = "SELECT price FROM item_detail WHERE `itemID` = '".$myItem."' and `user_id`='63' and groupID='6'"; $rs=mysql_query($sql); $row = mysql_fetch_array($rs); $myItemPrice = $row['price']; } how can i avoid loop here please ?
  12. thank you very much for the solution and valuable suggestions. i am now learning the way of doing optimized programming
  13. No they are title of products from another table associated with each itemID Array ( [0] => 110096692315 [itemID] => 110096692315 [1] => paper pager paager paper pitty [title] => paper pager paager paper pitty [2] => 17.89 [price] => 17.89 [3] => 0 [soldQty] => 0 [4] => 1345120513 [date] => 1345120513 )
  14. in the following way please $data = [date, title_a, title_b, title_c,.........], [date_value1, price_of_a, price_of_b, price_of_c.....], [date_value2, price_of_a, price_of_b, price_of_c.....], [date_value3, price_of_a, price_of_b, price_of_c.....], ...........
  15. this is what i got as output Array ( [0] => 110096692315 [itemID] => 110096692315 [1] => paper pager paager paper pitty [title] => paper pager paager paper pitty [2] => 17.89 [price] => 17.89 [3] => 0 [soldQty] => 0 [4] => 1345120513 [date] => 1345120513 )
×
×
  • 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.