mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
you eventually could pretty much answer that question yourself just doing some reading, even if you are a beginner. a couple pointers: http://dev.mysql.com/doc/refman/5.5/en/ansi-diff-transactions.html http://dev.mysql.com/doc/refman/5.0/en/commit.html
-
regarding to your original question: this may help you to understand why is that happening http://dev.mysql.com/doc/refman/5.0/en/type-conversion.html for testing purposes check what this select return to you SELECT 1 * '';
-
the procedure that you posted: create procedure sp_new_empdet -> (in p_name varchar(50),in p_address varchar(100),in p_phone varchar(20)) .... .... the posted error: is not the error clear? ... sp_new_empdet != sp_new_emp
-
MATCH AGAINST, why does it work without full text indexes?
mikosiko replied to niclas's topic in MySQL Help
Ref: http://dev.mysql.com/doc/refman/5.5/en/fulltext-restrictions.html -
ok... here is one way to get the results that you were looking for... (DIVIDE the problem and UNION): SELECT j.job_id As Job, EXTRACT(YEAR_MONTH FROM proj_end_date) as Jobdate, 'Typesetting' AS 'JobType', SUM(j.job_pages) AS 'JobPages', a.analysis_gross AS 'AnalysisGross', a.analysis_net AS 'AnalysisNet', SUM(ii.invoice_item_price) AS JobPrice FROM tbl_job as j INNER JOIN tbl_task_item as ti1 ON ti1.FK_job_id = j.job_id INNER JOIN tbl_task as t ON t.task_id = ti1.FK_task_id AND t.task_title='Typesetting' INNER JOIN tbl_invoice_item as ii ON ii.FK_job_id = j.job_id INNER JOIN tbl_invoice as i ON i.invoice_id=ii.FK_invoice_id INNER JOIN tbl_analysis as a ON a.FK_job_id = j.job_id INNER JOIN tbl_project as p ON p.proj_id = j.FK_proj_id WHERE p.FK_cust_id = 1 AND proj_status='Complete' UNION SELECT j.job_id As Job, EXTRACT(YEAR_MONTH FROM proj_end_date) as Jobdate, 'Non-Typest' AS 'JobType', SUM(j.job_pages) AS 'JobPages', a.analysis_gross AS 'AnalysisGross', a.analysis_net AS 'AnalysisNet', ii.invoice_item_price AS JobPrice FROM tbl_job as j INNER JOIN tbl_task_item as ti1 ON ti1.FK_job_id = j.job_id INNER JOIN tbl_task as t ON t.task_id = ti1.FK_task_id AND t.task_title !='Typesetting' INNER JOIN tbl_invoice_item as ii ON ii.FK_job_id = j.job_id INNER JOIN tbl_invoice as i ON i.invoice_id=ii.FK_invoice_id INNER JOIN tbl_analysis as a ON a.FK_job_id = j.job_id INNER JOIN tbl_project as p ON p.proj_id = j.FK_proj_id WHERE p.FK_cust_id = 1 AND proj_status ='Complete' AND j.job_id NOT IN (SELECT x.job_id FROM tbl_job as x INNER JOIN tbl_task_item as tti ON tti.FK_job_id = x.job_id INNER JOIN tbl_task as tt ON tt.task_id = tti.FK_task_id AND tt.task_title ='Typesetting') GROUP BY Job, JobDate,JobType ORDER BY Job,JobDate, JobType DESC; and the results:
-
why do you want to do that?
-
apply the 2 hints then... try... it should work ... just re-think the query a little starting with what you have now... remember... divide ... union ... that is one way to do it
-
under which condition? at first glance doesn't look possible in the current query (I could be wrong)... but... that is for you to work on... 2 hints for an alternative solution .... 1) Divide to Reign... 2) UNION
-
just to validate a couple things: a) What kind of relationship is between tbl_JOBS and tbl_Analysis? 1:n or 1:1 ? ... if the relationship is 1:1 as it seems to be, you don't need to SUM() the columns analysis_gross nor analysis_net. b) run this query and post the results: SELECT b.FK_job_id, a.task_id, a.task_title, b.status AS TaskItem_Status FROM tbl_task AS a JOIN tbl_task_item AS b ON a.task_id = b.FK_task_id ORDER BY b.FK_job_id, a.task_id; c) run this query and check if the results are consistent with the results of b) SELECT j.job_id As Job, EXTRACT(YEAR_MONTH FROM proj_end_date) as Jobdate, CASE WHEN task_title='Typesetting' AND ti1.status='Complete' THEN 'Typesetting' ELSE 'Non-Typest' END AS 'JobType', CASE WHEN task_title='Typesetting' AND ti1.status='Complete' THEN SUM(j.job_pages) ELSE j.job_pages END AS JobPages, a.analysis_gross AS 'AnalysisGross', a.analysis_net AS 'AnalysisNet', CASE WHEN task_title='Typesetting' AND ti1.status='Complete' THEN SUM(ii.invoice_item_price) ELSE ii.invoice_item_price END AS JobPrice FROM tbl_job as j INNER JOIN tbl_task_item as ti1 ON ti1.FK_job_id = j.job_id INNER JOIN tbl_task as t ON t.task_id = ti1.FK_task_id INNER JOIN tbl_invoice_item as ii ON ii.FK_job_id = j.job_id INNER JOIN tbl_invoice as i ON i.invoice_id=ii.FK_invoice_id INNER JOIN tbl_analysis as a ON a.FK_job_id = j.job_id INNER JOIN tbl_project as p ON p.proj_id = j.FK_proj_id WHERE p.FK_cust_id = 1 AND p.proj_status='Complete' GROUP BY Job, JobDate, JobType ORDER BY Job, JobDate, JobType DESC;
-
maybe? SELECT EXTRACT(YEAR_MONTH FROM proj_end_date) as job_date, CASE WHEN task_title='Typesetting' AND ti1.status='Complete' THEN SUM(invoice_item_price) ELSE invoice_item_price END AS total, CASE WHEN task_title='Typesetting' AND ti1.status='Complete' THEN 'Typeset' ELSE 'Non-Typeset' END AS 'JobType' FROM tbl_job as j INNER JOIN tbl_task_item as ti1 ON ti1.FK_job_id = j.job_id INNER JOIN tbl_task as t ON t.task_id = ti1.FK_task_id INNER JOIN tbl_invoice_item as ii ON ii.FK_job_id = j.job_id INNER JOIN tbl_invoice as i ON i.invoice_id=ii.FK_invoice_id INNER JOIN tbl_analysis as a ON a.FK_job_id = j.job_id INNER JOIN tbl_language as l ON l.lang_id = j.FK_langt_id INNER JOIN tbl_project as p ON p.proj_id = j.FK_proj_id WHERE p.FK_cust_id = 1 AND proj_status='Complete' GROUP BY job_date, JobType ORDER BY job_date, JobType DESC;
-
echo your variables $to, $subject, $message and $headers before that line and check if all of them are correct.
-
do you mean that your "huge PHP" script doesn't do nothing (white screen) with the posted code in and it works fine without it?... if that is the case maybe the inclusion of the posted code in your "huge php" is triggering a syntax error, hence the behavior. if that is not the case, why you don't isolate the posted code, provide dummy values to the variables and test it alone?... I did and your posted code is fine and capable to send mails without any modification on my side.
-
what is "it" ? which is the full URL that you are using?
-
SELECT query - apply LIMIT condition to unique items only
mikosiko replied to stubarny's topic in MySQL Help
How the objectives that you just posted are relate to your first one? both seems very different to me. what problem do you have using the timestamp?, and moreover is any reason why you are storing more than the latest website for a company? for better help please post your tables and the code that you have currently. BTW: To clarify... As fenway said DISTINCT is very slow on large datasets but, when used with LIMIT it is not critical (obviously assuming that your LIMIT's values are small), as an example: I do have a table with around 21 millions records and a SELECT DISTINCT <any_fieldname> FROM <the_table> LIMIT 50 only took around 0.0011s (0.0001s) ... that is no slow to me at all. -
SELECT query - apply LIMIT condition to unique items only
mikosiko replied to stubarny's topic in MySQL Help
and your point is? -
SELECT query - apply LIMIT condition to unique items only
mikosiko replied to stubarny's topic in MySQL Help
yes, I agree -
SELECT query - apply LIMIT condition to unique items only
mikosiko replied to stubarny's topic in MySQL Help
having in mind your data example, you don't need to use GROUP BY nor count() (unique has not the same meaning as distinct) for your objectives just use DISTINCT and LIMIT (starting at 6 or whatever you need) -
SELECT query - apply LIMIT condition to unique items only
mikosiko replied to stubarny's topic in MySQL Help
you maybe want to GROUP BY and select those elements with count() = 1 and then LIMIT your results starting in 6 -
what does echo $_SERVER['REQUEST_METHOD']; shows? did you check the ngnix website?
-
a quick search of the error message and similar on the ngnix site shows several hits; some of them pointing to some bugs and/or configuration issues for ngnix/php fastcgi that could be the cause of the behavior... maybe worth to look there.
-
I see a bad design for your table listings. a) agent, agent2 and category, category2 should not be part of listings those fields should be part of some "bridge" tables (one for listings-agents and probably one for listings-categories. b) you should be using agentID as the linking field instead of agent.name (same apply for categories) changing your design will give you a more flexible and generic model and your select will be more simple just using JOINs
-
assuming that $c was your DB link and having in mind that you said that your code was printing only one row (meaning that your query was correct in the way it was) you problem is the way that you are using mysql_result() a read of it definition is in order http://www.php.net/manual/en/function.mysql-result.php also you should read and look the examples of any of the forms of mysql_fetch_***() like mysql_fetch_assoc() per example http://www.php.net/manual/en/function.mysql-fetch-assoc.php
-
you are implementing an "Adjacency List"; this query let you get the children of a node. SELECT t1.id, t1.name, t2.id, t2.name FROM your-table AS t1 LEFT JOIN your-table AS t2 ON t2.parent_id = t1.id
-
This line: // Get Variables Here. $_POST['Item_Number'] = '$Item_Number'; should be at the bare minimum: // Get Variables Here. $Item_Number = $_POST['Item_Number'] ; however you should sanitize your $_POST['Item_Number'] before to assign/use it. Use the appropriated sanitation method depending of the data type of that item (mysql_real_escape_string, is_numeric(), ctype_digit(), etc..etc)
-
syntax error with updating one table into another table
mikosiko replied to Shadowing's topic in MySQL Help
which manual? did you read the link that was provided?