INSERT INTO
product_search_table (id, score)
VALUES (
SELECT product_id, 50 FROM cart_product WHERE product_id = 555
)
Run Code Online (Sandbox Code Playgroud)
给我一个错误.我究竟做错了什么?
555将被变量替换.
我在我的mysql数据库中有一个表,我经常需要更改并插入行,但是当我进行更改时它继续运行缓慢,因为有超过200k +条目.我测试了另一个表,它只有很少的行并且移动很快,所以它不是服务器或数据库本身,而是那个特别困难的表.我需要所有表的行,无法找到解决负载问题的解决方案.
DROP TABLE IF EXISTS `articles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `articles` (
`id` int(11) NOT NULL auto_increment,
`content` text NOT NULL,
`author` varchar(255) NOT NULL,
`alias` varchar(255) NOT NULL,
`topic` varchar(255) NOT NULL,
`subtopics` varchar(255) NOT NULL,
`keywords` text NOT NULL,
`submitdate` timestamp NOT NULL default CURRENT_TIMESTAMP,
`date` varchar(255) NOT NULL,
`day` varchar(255) NOT NULL,
`month` varchar(255) NOT NULL,
`year` varchar(255) NOT NULL,
`time` varchar(255) NOT NULL,
`ampm` varchar(255) …Run Code Online (Sandbox Code Playgroud) SQL查询:
CREATE TABLE `comment_threads` (
`comment_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',
`updated` TIMESTAMP NOT NULL ,
`timestamp` TIMESTAMP NOT NULL ,
) ENGINE = MYISAM ;
Run Code Online (Sandbox Code Playgroud)
这是一个旧文件,我试图通过phpMyAdmin在HostGator上运行.我收到一条错误消息:
MySQL说:#1064 - 你的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在第5行的')ENGINE = MyISAM'附近使用正确的语法
更新:如果我将语句更改为此,我仍然会收到错误:
CREATE TABLE comment_threads (
comment_id INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',
updated TIMESTAMP( 14 ) NOT NULL ,
timestamp TIMESTAMP NOT NULL
PRIMARY KEY ( comment_id ) )
ENGINE = MYISAM ;
Run Code Online (Sandbox Code Playgroud)
我收到错误:
错误1064(42000):您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在'(14)NOT NULL附近使用正确的语法,时间戳TIMESTAMP NOT NULL PRIMARY KEY(comment_id))ENGI'在第3行
我无法更改表中的数据..
UPDATE users
SET mem_expire = 2111-10-10 00:00:00
WHERE mem_expire = 0000-00-00 00:00:00;
Run Code Online (Sandbox Code Playgroud)
MySql错误:
#1064 - 您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在'00:00:00 WHERE mem_expire = 0000-00-00 00:00:00'附近的第2行使用正确的语法
我该如何解决这个问题?
执行查询时,我总是遇到此错误:
您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第1行'read = 1 WHERE user_id_sender = 1 AND user_id_receiver = 33 AND OR user_id_sender'附近使用正确的语法
这是我的查询:
mysql_query("UPDATE messages SET read =1 WHERE user_id_sender = $user_id AND user_id_receiver = $user_id_partner AND read = 0 OR user_id_sender = $user_id_partner AND user_id_receiver = $user_id AND read = 0 ") or die (mysql_error());
Run Code Online (Sandbox Code Playgroud)
在table(messages)具有这些列:
message_id(INT)(AI)
user_id_sender(INT)
user_id_receiver(INT)
message(TEXT)
read(INT)
Run Code Online (Sandbox Code Playgroud)
我真的不知道它为什么这样做,我看了网络但我似乎无法找到我的确切问题的答案.也许有人可以帮助我.
INSERT INTO 'tblJobNumbers'
VALUES (NULL, '3006', '05', 'THISTHS', 0, 'JOBLOCATION', '', '',
'JOBCOMMENTS', 'ES', '01/14/2013', '01/15/2013,
'', '', '', 'CRS-2', '25000')
Run Code Online (Sandbox Code Playgroud)
有我的陈述
jobID int(11) NOT NULL AUTO_INCREMENT COMMENT 'referenced by tblJobResources.jreJobID',
jobNumber int(4) NOT NULL,
jobPrefix int(2) NOT NULL COMMENT 'reference tblJobPreix.jprID',
jobCustomerTID varchar(7) NOT NULL,
jobCustomerID int(11) NOT NULL COMMENT 'reference tblCustomers.cusID',
jobLocation text NOT NULL,
jobContactName text NOT NULL,
jobContactInfo text NOT NULL,
jobComments text NOT NULL,
jobSoldBy varchar(2) NOT NULL COMMENT 'reference tblUsers.userID',
jobStartDate varchar(10) NOT NULL, …Run Code Online (Sandbox Code Playgroud) 我对php和MySQL有些新意.我正在阅读教程并在单击编辑主题按钮时收到以下错误消息.我将包含我正在使用的所有适用代码.我很确定问题在于数据库连接,因为显示的错误是从connection.php页面打印的.
错误:
数据库连接失败:您的SQL语法中有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的"1"附近使用正确的语法
数据库:
I have 1 database(widget_corp) with 3 tables
Tables:
subjects(id, menu_name, position, visible),
pages(id, subject_id, menu_name, position, visible, content),
users(id, username, hashed_password) //this one is not used yet
Run Code Online (Sandbox Code Playgroud)
源代码:
<?PHP require_once("includes/connection.php"); ?>
<?PHP require_once("includes/functions.php"); ?>
<?PHP
if(isset($_POST['submit'])) {
$errors = array();
$required_fields = array('menu_name', 'position', 'visible');
foreach($required_fields as $fieldname) {
if(!isset($_POST[$fieldname]) || (empty($_POST[$fieldname]) && !is_numeric($_POST[$fieldname]))) {
$errors[] = $fieldname;
}
}
$fields_with_lengths = array('menu_name' => 30);
foreach($fields_with_lengths as $fieldname => $maxlength) {
if(strlen(trim(mysql_prep($_POST[$fieldname]))) > $maxlength) { …Run Code Online (Sandbox Code Playgroud) 错误消息:
1064 - 您的SQL语法出错; 查看与您的MySQL服务器版本对应的手册,以便在'values('name','url','address','city','state','zip','phone')附近使用正确的语法,值('name','url'在第3行
创建表:
create table lawyer_info
(firm_name varchar(100) not null,
firm_url varchar(100) not null,
firm_address varchar(100) not null,
firm_city varchar(100) not null,
firm_state varchar(100) not null,
firm_zip varchar(12) not null,
firm_phone varchar(15) not null);
Run Code Online (Sandbox Code Playgroud)
数据:
insert into lawyer_info firm_name,firm_url,firm_address,firm_city,firm_state,firm_zip,firm_phone)
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone'),
values('name','url','address','city','state','zip','phone');
Run Code Online (Sandbox Code Playgroud) 我创建了简单的sql脚本,并尝试在phpMyAdmin中执行它.它给出了错误消息:
#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 '{ id INT, firstName VARCHAR(15), lastName VARCHAR(15), email VARCHAR(20)' at line 1
Run Code Online (Sandbox Code Playgroud)
这是代码:
CREATE TABLE phoneList{id INT,
firstName VARCHAR( 15 ) ,
lastName VARCHAR( 15 ) ,
email VARCHAR( 20 ) ,
phone VARCHAR( 15 ) };
Run Code Online (Sandbox Code Playgroud) 在编写以下代码后遇到了我从未见过的错误:
$query= "UPDATE `Pharm_Log` SET `text` = ". $bloodtest . " WHERE `id` = " . $patientid;
$result = mysql_query($query) or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)
我的错误信息是这个
"您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以便
id在第1行'压力测试:235/43 WHERE = 1' 附近使用正确的语法"
任何人都知道如何解决这个问题?我将不胜感激