Home > database >  Help to see what's the problem with this SQL
Help to see what's the problem with this SQL

Time:09-16

SELECT
Log_id,
The date (log_lastloginDate),
The date (log_createDate),
Log_score,
Log_scoreFishingGet,
Log_scoreFishingCost,
Log_cannon_level1,
Log_cannon_level2,
Log_level
The FROM
` t_player_unpack `
WHERE
The date (log_lastloginDate)=DATE_ADD (
The date (
Log_createDate,
The INTERVAL is 1 DAY
);

CodePudding user response:


 SELECT log_id,The DATE (log_lastloginDate), 
The DATE (log_createDate),
Log_score,
Log_scoreFishingGet,
Log_scoreFishingCost,
Log_cannon_level1,
Log_cannon_level2,
Log_level
The FROM ` t_player_unpack `
- get log_lastloginDate + 1 day after the date of the field section and log_createDate equal to the date of record
WHERE the DATE (log_lastloginDate)=DATE_ADD (DATE (log_createDate), INTERVAL 1 DAY);

CodePudding user response:

This statement query times wrong, prompt syntax error, can't use this kind of writing?

CodePudding user response:

How to use DateAdd function (syntax) :

DateAdd (Datapart, number, [ dateColumn/datefunction ])
The SELECT getdate ()
The SELECT DATEADD (Year, 1, getdate ())
The SELECT DATEADD (Month, 1, getdate ())
The SELECT DATEADD (Day 1, getdate ())
The SELECT DATEADD (hour, 1, getdate ())
The SELECT DATEADD (Minute, 1, getdate ())
The SELECT DATEADD (Second, 1, getdate ())

CodePudding user response:

You exactly MySQL or Sql Server?
Stick to create table statement come out,

CodePudding user response:

MySQL, where the last query conditions, if written is the DATE (log_lastloginDate)=DATE (log_createDate) is not an error, this is a predicate sentence:
The CREATE TABLE ` t_player_unpack ` (
` log_id ` bigint (20) NOT NULL DEFAULT '0',
` log_name ` varchar (128) the DEFAULT ',
` log_platform ` bigint (20) DEFAULT '0',
` log_lastLoginDay ` bigint (20) DEFAULT '0',
` log_totalLoginDays ` bigint (20) DEFAULT '0',
` log_createDate ` varchar (128) the DEFAULT ',
` log_inroomtime ` bigint (20) DEFAULT '0',
` log_lastSaveTime ` bigint (20) DEFAULT '0',
` log_device ` varchar (128) the DEFAULT ',
` log_score ` bigint (20) DEFAULT '0',
` log_scoreResetTick ` bigint (20) DEFAULT '0',
` log_scoreRate ` bigint (20) DEFAULT '0',
` log_scoreFishingGet ` bigint (20) DEFAULT '0',
` log_scoreFishingCost ` bigint (20) DEFAULT '0',
` log_scoreChangeDt ` bigint (20) DEFAULT '0',
` log_dayOlTime ` bigint (20) DEFAULT '0',
` log_lgameFruitDelScore ` bigint (20) DEFAULT '0',
` log_lgameFruitAddScore ` bigint (20) DEFAULT '0',
` log_lgameFruitDailyCntScore ` bigint (20) DEFAULT '0',
` log_lgameFruitDailyScore ` bigint (20) DEFAULT '0',
` log_lgameFruitCntScore ` bigint (20) DEFAULT '0',
` log_sm_name ` varchar (128) the DEFAULT ',
` log_sm_phone ` varchar (128) the DEFAULT ',
` log_sm_idcard ` varchar (128) the DEFAULT ',
` log_phonenum ` bigint (20) DEFAULT '0',
` log_createversion ` varchar (128) the DEFAULT ',
` log_shootnum ` bigint (20) DEFAULT '0',
` log_klogindays ` bigint (20) DEFAULT '0',
` log_maxklogindays ` bigint (20) DEFAULT '0',
` log_klogindaysLoginTimes ` bigint (20) DEFAULT '0',
` log_cmtversion ` varchar (128) the DEFAULT ',
` log_xgtoken ` varchar (128) the DEFAULT ',
` log_scoreGetT ` bigint (20) DEFAULT '0',
` log_scoreCostT ` bigint (20) DEFAULT '0',
` log_lgameLhdDelScore ` bigint (20) DEFAULT '0',
` log_lgameLhdAddScore ` bigint (20) DEFAULT '0',
` log_lgameLhdDailyCntScore ` bigint (20) DEFAULT '0',
` log_lgameLhdDailyScore ` bigint (20) DEFAULT '0',
` log_lgameLhdCntScore ` bigint (20) DEFAULT '0',
` log_lgameWxhhDelScore ` bigint (20) DEFAULT '0',
` log_lgameWxhhAddScore ` bigint (20) DEFAULT '0',
` log_lgameWxhhDailyCntScore ` bigint (20) DEFAULT '0',
` log_lgameWxhhDailyScore ` bigint (20) DEFAULT '0',
` log_lgameWxhhCntScore ` bigint (20) DEFAULT '0',
` log_lgameShuihuDelScore ` bigint (20) DEFAULT '0',
` log_lgameShuihuAddScore ` bigint (20) DEFAULT '0',
` log_lgameShuihuDailyCntScore ` bigint (20) DEFAULT '0',
` log_lgameShuihuDailyScore ` bigint (20) DEFAULT '0',
` log_lgameShuihuCntScore ` bigint (20) DEFAULT '0',
` log_lgameShuihuCfg ` bigint (20) DEFAULT '0',
` log_lgameNiuniuDelScore ` bigint (20) DEFAULT '0',
` log_lgameNiuniuAddScore ` bigint (20) DEFAULT '0',
` log_lgameNiuniuDailyCntScore ` bigint (20) DEFAULT '0',
` log_lgameNiuniuDailyScore ` bigint (20) DEFAULT '0',
` log_lgameNiuniuCntScore ` bigint (20) DEFAULT '0',
` log_gameScoreCost ` bigint (20) DEFAULT '0',
` log_gameScoreGet ` bigint (20) DEFAULT '0',
` log_lgameNiuniuZDScore ` bigint (20) DEFAULT '0',
` log_wxname ` varchar (128) the DEFAULT ',
` log_lastloginDate ` varchar (128) the DEFAULT ',
` log_scoreResetTick_2 ` bigint (20) DEFAULT '0',
` log_scoreRate_2 ` bigint (20) DEFAULT '0',
` log_scoreResetTick_3 ` bigint (20) DEFAULT '0',
` log_scoreRate_3 ` bigint (20) DEFAULT '0',
` log_scoreResetTick_4 ` bigint (20) DEFAULT '0',
` log_scoreRate_4 ` bigint (20) DEFAULT '0',
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related