
beyzad
Members-
Posts
109 -
Joined
-
Last visited
Everything posted by beyzad
-
Hello sir. My indexes are shown in the SQL provided above. There are 53.7MB data + 7MB index @ factors table and 88.9MB data + 13.1MB index @ factor_times table. If you have any suggestion changing my indexes, I'll appreciate that. This is not working. shouldn't the conditions for RIGHT table be in join part of query?
-
Hello there. I have 2 table: factors: CREATE TABLE IF NOT EXISTS `factors` ( `vendor_id` varchar( COLLATE utf8_unicode_ci NOT NULL, `factor_key` varchar(18) COLLATE utf8_unicode_ci NOT NULL, `factor_status` enum('0','1','2','3','4','5','6','7','8','9','10','11') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT '0: pending. 1: ready. 2:sent. 3:delivered. 4:canceled. 5:returned. 6:return_confirmed. 7: canceled_by_post. 8: banned. 9: waiting. 10: failed CASH. 11: transferred', UNIQUE KEY `factor_key` (`factor_key`), KEY `vendor_id` (`vendor_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; factor_times: CREATE TABLE IF NOT EXISTS `factor_times` ( `factor_key` varchar(18) COLLATE utf8_unicode_ci NOT NULL, `factor_status` int(11) NOT NULL, `factor_time` int(11) NOT NULL, KEY `factor_key` (`factor_key`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; Factor times will save timestamp for each status (0 to 11). each factor_key can have unlimited statuses and times. for example, a factor can go to status 1, then go back to 0, then go to 2, then 3, then back to 1 .... What i want, is to export first time of statuss of (0,2,3,6) for each day of the month. for example, i want to export orders that been in status (0,2,3,6) in November, grouped day by day. What i tried is something like this: SELECT `factor_times`.`factor_status`, MIN(`factor_times`.`factor_time`) FROM `factor_times` INNER JOIN `factors` ON `factor_times`.`factor_key`=`factors`.`factor_key` AND `factors`.`vendor_id`='03010001' WHERE `factor_times`.`factor_status` IN (0,2,3,6) AND `factor_times`.`factor_time` > 1437507000 AND `factor_times`.`factor_time` > 1440185400 GROUP BY `factor_times`.`factor_key` This used to export all times in a period, so i can use PHP code to assign them to each day of month. But it takes so so so so so so long to execute. factor rows: 246,718 factor_times rows: 2,915,127 Sorry for poor English :happy-04:
-
Thanks. I owe you :happy-04:
-
Hi there. I have a table named `cat` that looks like this: id |name |parent --------+---------------+------ 1 |cat1 |0 --------+---------------+------ 2 |cat2 |0 --------+---------------+------ 3 |subcat1 |1 --------+---------------+------ 4 |subcat2 |1 --------+---------------+------ 5 |subsubcat1 |3 --------+---------------+------ I need to export something like this with only 1 query if it is possible: id |name |parent(name) --------+---------------+------------ 1 |cat1 |NULL --------+---------------+------------ 2 |cat2 |NULL --------+---------------+------------ 3 |subcat1 |cat1 --------+---------------+------------ 4 |subcat2 |cat1 --------+---------------+------------ 5 |subsubcat1 |subcat1 --------+---------------+------------ Thanks.
-
Hi there. I have 2 tables like this: factor_times: +------------+---------------------+--------+ | factor_key | factor_time | status | +------------+---------------------+--------+ | 1 | 1313131313 | 1 | | 1 | 1313131314 | 2 | | 1 | 1313131315 | 1 | | 1 | 1313131316 | 2 | | 2 | 1313131317 | 1 | | 2 | 1313131318 | 3 | | 3 | 1313131319 | 1 | | 3 | 1313131320 | 6 | +------------+---------------------+--------+ and factors: +------------+---------------+ | factor_key | factor_status | +------------+---------------+ | 1 | 2 | | 2 | 3 | | 3 | 6 | +------------+---------------+ now, I want to make a query that will results all factors, Maximum time of current status and its status with specified time range. I used a query like this: SELECT `factors`.*,`factor_times`.`factor_time` AS `update` FROM `factors` LEFT JOIN `factor_times` ON `factors`.`factor_key`=`factor_times`.`factor_key` AND `factor_times`.`factor_status`=2 AND `factor_times`.`factor_time` <= 1313131320 AND `factor_times`.`factor_time` >= 1313131313 WHERE `factors`.`factor_status`='2' I also must say that a factor can have multiple times in a single status. For example, factor status can be changed to 2, then 1, then again 2, then 3, then again 2 and go on. Thanks
-
Ok looks like i am doing wrong or something. Here is what i wanna do: - I am creating a game using HTML. - For a section of game, I have to put 4 images on top of each other. For example: face, eyes, nose and mouth. - I need to make 2 buttons for each image so people can swith to next, previous images in array. - It's better to avoid using AJAX. so i want to do this only with javascript and CSS. Thanks.
-
Hi. I need the exact file name. I have no problem using php as well. Thanks.
-
Hi there. I have a problem getting an element background image. If i use class and define it in external css, i can't even get the background. If i use style argument, the output is vary in browsers. For example in IE & FF the output is: url:("image.png") But in chrome the output is: url:("file:///c:/users/.....") Any suggestion? Thanks
-
Thank you sir. Works perfect.
-
Thanks you sir. Here is the conf i tried to do. but my problem is all A records are pointer to a same ip. Additional info is the OS is windows 7 <VirtualHost 127.0.0.2> DocumentRoot "H:/alavian/dl" ServerName dl.yasdownload.com </VirtualHost> <VirtualHost 127.0.0.3> DocumentRoot "H:/alavian/dl1" ServerName dl1.yasdownload.com </VirtualHost> <VirtualHost 127.0.0.4> DocumentRoot "H:/alavian/dl2" ServerName dl2.yasdownload.com </VirtualHost> <VirtualHost 127.0.0.5> DocumentRoot "H:/alavian/dl3" ServerName dl3.yasdownload.com </VirtualHost> <VirtualHost 127.0.0.6> DocumentRoot "H:/alavian/dl4" ServerName dl4.yasdownload.com </VirtualHost> <VirtualHost 127.0.0.7> DocumentRoot "H:/alavian/dl5" ServerName dl5.yasdownload.com </VirtualHost> I also tried to write to host file. but IDK how to convert requested server name to local IP. Thanks.
-
The server is right behind me
-
Hi there. I have 6 A records on a domain that points to my server. And my server has only 1 IP. There is no control panel installed and it is a poor apache web server. So how can i assign a folder for each A record? Thanks.
-
YOU ARE HERO. Thanks a lot.
-
Hi. Do not remove your first 4 lines. your code must be something like this: <?php $host_name = "localhost"; $user_name = "root"; $password = ""; $db_name = "finalproject"; $term = $_POST['term']; $sql = "SELECT * FROM student WHERE student_id like '%$term%' or ic_number like '%$term%'"; $query = mysql_query($sql) or die("Error: " . mysql_error() . "<br />In Query: " . $sql); ?>
-
Hi again. Here is my structure: CREATE TABLE IF NOT EXISTS `partners` ( `partner_id` int(11) NOT NULL AUTO_INCREMENT, `vendor_id` varchar( COLLATE utf8_unicode_ci NOT NULL, `partner_user` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `partner_pass` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `partner_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL, `partner_site` varchar(75) COLLATE utf8_unicode_ci NOT NULL, `partner_phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `partner_cell` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `partner_email` varchar(75) COLLATE utf8_unicode_ci NOT NULL, `partner_bank` varchar(75) COLLATE utf8_unicode_ci NOT NULL, `partner_account` varchar(75) COLLATE utf8_unicode_ci NOT NULL, `partner_credit_card` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `partner_active` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes', `partner_valid` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes', PRIMARY KEY (`partner_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `partner_products` -- CREATE TABLE IF NOT EXISTS `partner_products` ( `partner_id` int(11) NOT NULL, `vendor_id` varchar( COLLATE utf8_unicode_ci NOT NULL, `product_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `partner_product_percent` int(11) NOT NULL, UNIQUE KEY `partner_id` (`partner_id`,`vendor_id`,`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE IF NOT EXISTS `products` ( `vendor_id` varchar( COLLATE utf8_unicode_ci NOT NULL, `product_category_id` int(11) NOT NULL, `product_id` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `product_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `product_weight` int(11) NOT NULL, `product_price` int(11) NOT NULL, `product_active` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes', KEY `vendor_id` (`vendor_id`,`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; I have a table named products that keeps product information of all vendors. I also have a partner table that keeps partner information for each vendor. There is a third party table named partner_products that keeps assigned products from products to partners. Vendors will choose which product can be assigned to which partner. That means there may be only 10 out of 100 products available for a partner. Now i want to make a query that list all products of a vendor. also for those that been assigned for a specified partner, the other fields from partner_products needed. Thanks.
-
Hi. You wrote the same query i used in my 1st post in this topic. my result on this query is this: vendor_id | product_id | partner_id | ..... ----------------------------------- 1 | 1 | 1 1 | 3 | 1 May be i am experiencing some version bug or something? Is this neede to post my whole DB so you can see the confusing results? Thanks.
-
Hi. I didn't mean to waste your time sir. But as i said in topic title, I need to join 2 tables using 2 columns. I have also some condition for my left table. table1: vendor_id | product_id | ..... ----------------------------------- 1 | 1 | ..... 1 | 2 | ..... 1 | 3 | ..... 2 | 1 | ..... 2 | 2 | ..... 2 | 3 | ..... table2: vendor_id | product_id | partner_id | ..... ----------------------------------- 1 | 1 | 1 1 | 3 | 1 Now i want to export all rows with vendor_id=1 from table1, also export matching rows with same vendor_id and product_id from table2 I need something like this: vendor_id | product_id | partner_id | ..... ----------------------------------- 1 | 1 | 1 1 | 2 | NULL 1 | 3 | 1 I wish i was clear this time. Thanks.
-
Hi sir. Ofc i want all rows, but with conditions. The condition is `vendor_id` = '23060001' Thanks.
-
Hi. Thanks sir. I tried your suggestion. also this one: SELECT * FROM `products` p LEFT JOIN `partner_products` pp ON p.vendor_id = pp.vendor_id AND p.product_id = pp.product_id AND p.`vendor_id` = '23060001' AND pp.`partner_id` = '1' But in both, All rows, even rows without `vendor_id` = '23060001' are returned. Thanks.
-
Hi there. I have a query like the following: SELECT * FROM `products` LEFT JOIN `partner_products` USING ( `vendor_id` , `product_id` ) WHERE `partner_products`.`vendor_id` = '23060001' AND `partner_products`.`partner_id` = '1' As i read in many pages, the following query must export every rows in `products` table even if there is no matching row in `partner_products` table. but this only results rows with matching conditions. any suggestion please? Thanks.
-
Hi. Im not sure, but i think this is because in your first rule, you redirected ALL urls. Try to expand you conditions.
- 3 replies
-
- mod_rewrite
- htaccess
-
(and 2 more)
Tagged with: