<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Question2Answer Q&amp;A - Recent questions tagged sql</title>
<link>https://www.question2answer.org/qa/tag/sql</link>
<description>Powered by Question2Answer</description>
<item>
<title>Why database size becomes so large on mysql ?</title>
<link>https://www.question2answer.org/qa/102698/why-database-size-becomes-so-large-on-mysql</link>
<description>Why database size becomes so large on mysql ?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/102698/why-database-size-becomes-so-large-on-mysql</guid>
<pubDate>Wed, 03 Aug 2022 07:37:11 +0000</pubDate>
</item>
<item>
<title>Q2A Performance Queries Issue</title>
<link>https://www.question2answer.org/qa/96008/q2a-performance-queries-issue</link>
<description>I try to log all the queries when post a new question and there are approximately 80 queries. Some queries take a lot of time such as:&lt;br /&gt;
&lt;br /&gt;
INSERT INTO qa_contentwords (postid, wordid, count, type, questionid) ~ 2s&lt;br /&gt;
&lt;br /&gt;
INSERT INTO qa_titlewords (postid, wordid) ~ 1s&lt;br /&gt;
&lt;br /&gt;
INSERT INTO qa_sharedevents (entitytype, entityid, questionid, lastpostid, updatetype, lastuserid, updated) ~ 1s&lt;br /&gt;
&lt;br /&gt;
So it takes ~10s for posting a new question. Do you guys face up with this issue? And how to solve this problem?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/96008/q2a-performance-queries-issue</guid>
<pubDate>Mon, 06 Sep 2021 09:27:43 +0000</pubDate>
</item>
<item>
<title>Critical Issue with Q2A getting error and database becomes irresponsive.</title>
<link>https://www.question2answer.org/qa/88183/critical-issue-getting-error-database-becomes-irresponsive</link>
<description>I am running q2a site but sometimes I am getting error and database becomes irresponsive.&lt;br /&gt;
&lt;br /&gt;
And when I see the performance insights I see LOCK TABLES qa_words WRITE is causing the issue.&lt;br /&gt;
&lt;br /&gt;
Randomly getting LOCK TABLES qa_words WRITE in Q2A which is causing DB read operation blocked for the specific time.&lt;br /&gt;
&lt;br /&gt;
Please anyone help me understand the issue to resolve it.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/88183/critical-issue-getting-error-database-becomes-irresponsive</guid>
<pubDate>Wed, 07 Oct 2020 11:33:57 +0000</pubDate>
</item>
<item>
<title>Critical Issue with Q2A Framework: have high performance issue due to Table Locking</title>
<link>https://www.question2answer.org/qa/88164/critical-issue-framework-performance-issue-table-locking</link>
<description>Q2A have high performance issue due to Table Locking.&lt;br /&gt;
&lt;br /&gt;
During locking all select sql query goes in wait status and effecting heavily on performance of q2a.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/88164/critical-issue-framework-performance-issue-table-locking</guid>
<pubDate>Wed, 07 Oct 2020 06:01:31 +0000</pubDate>
</item>
<item>
<title>Prevent sql injection in q2a custom php form ?</title>
<link>https://www.question2answer.org/qa/82413/prevent-sql-injection-in-q2a-custom-php-form</link>
<description>

&lt;p&gt;This is how i store data in mysql via php form. I know its security risk.&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;Examples - $price = $_POST['price'];&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;$price = array_key_exists('price', $_POST) ? $_POST['price'] : &quot;&quot;;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;and sql query is -&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;$insertqry = qa_db_query_sub(&quot;INSERT INTO test_table (title, price) VALUES ('$title','$price')&quot;);&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;How should i post data in latest php 7 and above version ?
&lt;br&gt;I think escape string is deprecated or outdated.&lt;/p&gt;

&lt;p&gt;Thanks for your help !&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/82413/prevent-sql-injection-in-q2a-custom-php-form</guid>
<pubDate>Tue, 31 Mar 2020 19:33:04 +0000</pubDate>
</item>
<item>
<title>SQL statement to find answers that older than their question more than XX hours</title>
<link>https://www.question2answer.org/qa/82375/statement-find-answers-that-older-than-their-question-hours</link>
<description>I need an SQL statement to SELECT answers that older than their question more than XX hours for spesific userid</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/82375/statement-find-answers-that-older-than-their-question-hours</guid>
<pubDate>Mon, 30 Mar 2020 17:04:33 +0000</pubDate>
</item>
<item>
<title>My application uses sql server db how can I login throuh my app credential on Q2A ?</title>
<link>https://www.question2answer.org/qa/71874/application-uses-sql-server-how-can-login-throuh-credential</link>
<description>Hello Guys I have web application which uses sql server as g=db.&lt;br /&gt;
&lt;br /&gt;
I want to login on Q2A using my application.&lt;br /&gt;
&lt;br /&gt;
Is there any way to do that?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/71874/application-uses-sql-server-how-can-login-throuh-credential</guid>
<pubDate>Mon, 14 Jan 2019 19:08:56 +0000</pubDate>
</item>
<item>
<title>SQL statement to sort qa_posts</title>
<link>https://www.question2answer.org/qa/67029/sql-statement-to-sort-qa_posts</link>
<description>is there any SQL statement to sort qa_posts by times of updated ?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/67029/sql-statement-to-sort-qa_posts</guid>
<pubDate>Fri, 07 Sep 2018 20:29:16 +0000</pubDate>
</item>
<item>
<title>which directories should I keep for a migration?</title>
<link>https://www.question2answer.org/qa/61822/which-directories-should-i-keep-for-a-migration</link>
<description>I just need users and questions</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/61822/which-directories-should-i-keep-for-a-migration</guid>
<pubDate>Mon, 08 Jan 2018 21:52:58 +0000</pubDate>
</item>
<item>
<title>SQL query help</title>
<link>https://www.question2answer.org/qa/60619/sql-query-help</link>
<description>I was trying to count the userpoints per category. The query works if I use a single level of category match. But if I try to get the points on subcategories too, the query gets too slow as it runs on uservotes table having thousands of rows. Is there a better way to do this? The current query is as follows with part of it coming from points update function in the core.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;$catfilter = &amp;quot; &amp;nbsp;and (userid_src.categoryid = b.categoryid or userid_src.categoryid &amp;nbsp;in &amp;nbsp;(&lt;br /&gt;
select categoryid from ^categories where parentid = b.categoryid)&lt;br /&gt;
or userid_src.categoryid &amp;nbsp;in &amp;nbsp;(&lt;br /&gt;
select categoryid from ^categories where parentid in (select categoryid from ^categories where parentid = b.categoryid)))&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
$query1 = &amp;quot;insert into ^catpoints (categoryid, userid, points) &amp;nbsp;(select &amp;nbsp;b.categoryid,#, &amp;quot;.&lt;br /&gt;
$calculations['aselecteds']['multiple'].&amp;quot;*(select &amp;nbsp;&amp;quot;.$calculations['aselecteds']['formula'].$catfilter.&amp;quot;)+&amp;quot;.&lt;br /&gt;
$calculations['avoteds']['multiple'].&amp;quot;*(select &amp;nbsp;&amp;quot;.$calculations['avoteds']['formula'].$catfilter.&amp;quot;)&lt;br /&gt;
as points&lt;br /&gt;
&amp;nbsp;from &amp;nbsp;^categories b) on duplicate key update ^catpoints.points=points&amp;quot;;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/60619/sql-query-help</guid>
<pubDate>Fri, 03 Nov 2017 03:42:57 +0000</pubDate>
</item>
<item>
<title>How create user in Php/SQL</title>
<link>https://www.question2answer.org/qa/56375/how-create-user-in-php-sql</link>
<description>I need to create users with Php/SQL. I found theses links but It do not helping me :&lt;br /&gt;
&lt;a href=&quot;http://www.question2answer.org/qa/30100/how-to-change-a-user-password-from-the-database&quot; rel=&quot;nofollow&quot;&gt;http://www.question2answer.org/qa/30100/how-to-change-a-user-password-from-the-database&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.question2answer.org/qa/4883/password-encryption-method&quot; rel=&quot;nofollow&quot;&gt;http://www.question2answer.org/qa/4883/password-encryption-method&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I've see the `qa_users` but I don't know how to provide it (`passsalt`,`passcheck`, `createip` etc.)&lt;br /&gt;
&lt;br /&gt;
Can you help me?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/56375/how-create-user-in-php-sql</guid>
<pubDate>Thu, 23 Feb 2017 02:02:50 +0000</pubDate>
</item>
<item>
<title>Data not showing up after imported sql</title>
<link>https://www.question2answer.org/qa/53707/data-not-showing-up-after-imported-sql</link>
<description>I have an OLD version of Q2A, which I'm trying to upgrade to the latest. &amp;nbsp;But I am also doing the wordpress integration. &lt;br /&gt;
&lt;br /&gt;
So my steps have been:&lt;br /&gt;
&lt;br /&gt;
1) Installed wordpress on subdomain&lt;br /&gt;
&lt;br /&gt;
2) Integrated SSO with wordpress and fresh installation of Q2A on a different subdomain (worked)&lt;br /&gt;
&lt;br /&gt;
3) Exported &amp;amp; Imported old Q2A database to new integrated database, but problem is none of the questions are showing up, just the categories e.g. &amp;quot;blah blah (50)&amp;quot;. &amp;nbsp;Even tried it on the same domain that the old questions are on, no luck. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Any help? Thanks!</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/53707/data-not-showing-up-after-imported-sql</guid>
<pubDate>Mon, 12 Sep 2016 07:51:19 +0000</pubDate>
</item>
<item>
<title>SQL query to find questions with answers only</title>
<link>https://www.question2answer.org/qa/52028/sql-query-to-find-questions-with-answers-only</link>
<description>

&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;I am currently using the following query to display Questions in a separate Wordpress instance.&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $result = mysql_query(&quot;SELECT * FROM qa_posts where type='Q' ORDER BY postid DESC LIMIT 0, 20&quot;)
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or die(mysql_error());&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Is it possible to ONLY select questions where there is an answer has been provided?&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Many thanks in advance.&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/52028/sql-query-to-find-questions-with-answers-only</guid>
<pubDate>Tue, 07 Jun 2016 06:39:58 +0000</pubDate>
</item>
<item>
<title>How to do not add ' character when using parameters with sql query</title>
<link>https://www.question2answer.org/qa/31880/how-to-not-add-character-when-using-parameters-with-sql-query</link>
<description>Sometimes when I used qa_db_query_sub() function to create a sql query, I like to use columns as parameters&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$sql = &amp;quot;select # from ^users&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qa_db_query_sub( $sql, 'id' );&lt;br /&gt;
&lt;br /&gt;
The problem here is Q2A adds ' character to parameters and make&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;select 'id' from db_users&amp;quot;&lt;br /&gt;
&lt;br /&gt;
That is wrong. I don't want those characters. How could I get rid of them?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/31880/how-to-not-add-character-when-using-parameters-with-sql-query</guid>
<pubDate>Fri, 14 Feb 2014 08:22:58 +0000</pubDate>
</item>
<item>
<title>Inserting a comment into Q2A via SQL</title>
<link>https://www.question2answer.org/qa/24226/inserting-a-comment-into-q2a-via-sql</link>
<description>

&lt;p&gt;
	How would I go about structuring a SQL INSERT to create a comment in the Q2A database?&lt;/p&gt;


&lt;p&gt;
	From my research so far, I'm working out that comments in the SQL are stored in qa_posts, e.g&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;font-family:courier new,courier,monospace;&quot;&gt;INSERT INTO qa_posts VALUES ('$postId', 'C', (lots of other data), 'Comment message.', NULL, NULL);&lt;/span&gt;&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/24226/inserting-a-comment-into-q2a-via-sql</guid>
<pubDate>Sat, 01 Jun 2013 11:26:15 +0000</pubDate>
</item>
<item>
<title>Microsoft SQL Server Data Access</title>
<link>https://www.question2answer.org/qa/21191/microsoft-sql-server-data-access</link>
<description>Is there a plug-in or has anyone tried to use MS SQL Server for the Q2A database?&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
If not, how hard would it be to do so?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/21191/microsoft-sql-server-data-access</guid>
<pubDate>Tue, 05 Feb 2013 10:30:21 +0000</pubDate>
</item>
<item>
<title>Add categories via SQL</title>
<link>https://www.question2answer.org/qa/20989/add-categories-via-sql</link>
<description>

&lt;p&gt;
	Hello,&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	is there any good way to import categories from csv file?&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	Mine only idea was by INSERT to database =&amp;gt;&amp;nbsp;&lt;span style=&quot;color: rgb(0, 128, 0); font-family: Verdan, Arial, Tahoma; font-size: 14px; white-space: pre; background-color: rgb(229, 229, 229);&quot;&gt;_categories&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;
	INSERT INTO `_categories`(`categoryid`, `parentid`, `title`, `tags`, `content`, `qcount`, `position`, `backpath`) VALUES ([value-1],[value-2],[value-3],[value-4],[value-5],[value-6],[value-7],[value-8])&lt;/p&gt;


&lt;p&gt;
	but I'm not sure is this way is Ok.&amp;nbsp;&lt;/p&gt;


&lt;p&gt;
	Can someone be so kind and confirm, if I will do such Insert I will not should have trouble with them?&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20989/add-categories-via-sql</guid>
<pubDate>Wed, 30 Jan 2013 07:05:34 +0000</pubDate>
</item>
<item>
<title>Error 1146: Error Facebook Conexion</title>
<link>https://www.question2answer.org/qa/20536/error-1146-error-facebook-conexion</link>
<description>

&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;


&lt;div&gt;
	

&lt;div&gt;
		Hello,&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		One member wanted to register on the site via the Facebook connection and had the following errors:&lt;/div&gt;
&lt;/div&gt;


&lt;blockquote&gt;
	

&lt;div&gt;
		Question2Answer query failed:&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		LOCK TABLES cibermondeqr WRITE, qa_blobs WRITE, qa_cache WRITE, qa_categories WRITE, qa_categorymetas WRITE, qa_contentwords WRITE, qa_cookies WRITE, qa_iplimits WRITE, qa_messages WRITE, qa_options WRITE, qa_pages WRITE, qa_postmetas WRITE, qa_posts WRITE, qa_posttags WRITE, qa_sharedevents WRITE, qa_tagmetas WRITE, qa_tagwords WRITE, qa_titlewords WRITE, qa_userevents WRITE, qa_userfavorites WRITE, qa_userfields WRITE, qa_userlimits WRITE, qa_userlogins WRITE, qa_usermetas WRITE, qa_usernotices WRITE, qa_userpoints WRITE, qa_userprofile WRITE, qa_users WRITE, qa_uservotes WRITE, qa_widgetanyw WRITE, qa_widgets WRITE, qa_words WRITE&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		Error 1146: Table 'QuestionReponses.cibermondeqr' doesn't exist&lt;/div&gt;
&lt;/blockquote&gt;


&lt;div&gt;
	

&lt;div&gt;
		Do you know where it is coming and how to fix it?&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		Thank you very much for your help&lt;/div&gt;
	

&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	

&lt;div&gt;
		good day&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20536/error-1146-error-facebook-conexion</guid>
<pubDate>Fri, 11 Jan 2013 05:57:34 +0000</pubDate>
</item>
<item>
<title>Badges create table</title>
<link>https://www.question2answer.org/qa/11458/badges-create-table</link>
<description>

&lt;p&gt;
	Looks like I will have to manually create the badges tables.. can I get the proper SQL for that please? I set permissions as described&lt;/p&gt;

&lt;br&gt;


&lt;table class=&quot;data&quot; id=&quot;dbspecificuserrights&quot;&gt;
	

&lt;tbody&gt;
		

&lt;tr class=&quot;noclick even&quot;&gt;
			

&lt;td&gt;
				database-specific&lt;/td&gt;
			

&lt;td&gt;
				&lt;code&gt;&lt;dfn title=&quot;Allows reading data.&quot;&gt;SELECT&lt;/dfn&gt;, &lt;dfn title=&quot;Allows inserting and replacing data.&quot;&gt;INSERT&lt;/dfn&gt;, &lt;dfn title=&quot;Allows changing data.&quot;&gt;UPDATE&lt;/dfn&gt;, &lt;dfn title=&quot;Allows deleting data.&quot;&gt;DELETE&lt;/dfn&gt;, &lt;dfn title=&quot;Allows creating new databases and tables.&quot;&gt;CREATE&lt;/dfn&gt;, &lt;dfn title=&quot;Allows altering the structure of existing tables.&quot;&gt;ALTER&lt;/dfn&gt;, &lt;dfn title=&quot;Allows locking tables for the current thread.&quot;&gt;LOCK TABLES&lt;/dfn&gt;&lt;/code&gt;&lt;/td&gt;
			

&lt;td&gt;
				Yes&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;
	but I can not get this to work properly&lt;/p&gt;</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/11458/badges-create-table</guid>
<pubDate>Tue, 27 Dec 2011 00:07:31 +0000</pubDate>
</item>
<item>
<title>MySQL query error 1064</title>
<link>https://www.question2answer.org/qa/7909/mysql-query-error-1064</link>
<description>

&lt;p&gt;
	Hi There I was unable to find an answer to this question so:&lt;/p&gt;


&lt;p&gt;
	Having installed Q2A I have an error log containing the following within my root directory:&lt;/p&gt;


&lt;p&gt;
	&lt;span style=&quot;color: #ff0000&quot;&gt;Question2Answer MySQL query error 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 'Q'&amp;amp;-_~0%\\@^*()=!()][`\';:|\&quot;.{},?50 Ï€Â§Â½Ð–×©' LIMIT 1) AND type=$ ORDER BY ' at line 1 &lt;/span&gt;&lt;/p&gt;


&lt;p&gt;
	I'm not so good with SQL debugging&lt;/p&gt;


&lt;p&gt;
	Also the editor isn't loading in any version of FireFox!.&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/7909/mysql-query-error-1064</guid>
<pubDate>Sun, 31 Jul 2011 14:15:40 +0000</pubDate>
</item>
</channel>
</rss>