Click here to Skip to main content
15,912,932 members
Home / Discussions / Database
   

Database

 
AnswerRe: Retail inventory management DB Design Pin
Victor Nijegorodov13-Apr-21 0:54
Victor Nijegorodov13-Apr-21 0:54 
AnswerRe: Retail inventory management DB Design Pin
RedDk13-Apr-21 12:10
RedDk13-Apr-21 12:10 
QuestionRe: Retail inventory management DB Design Pin
Eddy Vluggen13-Apr-21 13:00
professionalEddy Vluggen13-Apr-21 13:00 
AnswerRe: Retail inventory management DB Design Pin
Mycroft Holmes14-Apr-21 13:32
professionalMycroft Holmes14-Apr-21 13:32 
QuestionConvert date, did I go too far Pin
jkirkerx8-Apr-21 12:50
professionaljkirkerx8-Apr-21 12:50 
AnswerRe: Convert date, did I go too far Pin
Victor Nijegorodov8-Apr-21 20:22
Victor Nijegorodov8-Apr-21 20:22 
AnswerRe: Convert date, did I go too far Pin
Richard Deeming8-Apr-21 22:03
mveRichard Deeming8-Apr-21 22:03 
GeneralRe: Convert date, did I go too far Pin
jkirkerx9-Apr-21 6:14
professionaljkirkerx9-Apr-21 6:14 
GeneralRe: Convert date, did I go too far Pin
Mycroft Holmes9-Apr-21 12:21
professionalMycroft Holmes9-Apr-21 12:21 
GeneralRe: Convert date, did I go too far Pin
jkirkerx9-Apr-21 14:20
professionaljkirkerx9-Apr-21 14:20 
GeneralRe: Convert date, did I go too far Pin
Richard Deeming11-Apr-21 21:10
mveRichard Deeming11-Apr-21 21:10 
AnswerRe: Convert date, did I go too far, Sort of solved Pin
jkirkerx10-Apr-21 14:06
professionaljkirkerx10-Apr-21 14:06 
QuestionExcel Spreadsheet To Database Migration Assistance Pin
Glen McHale6-Apr-21 23:55
Glen McHale6-Apr-21 23:55 
SuggestionRe: Excel Spreadsheet To Database Migration Assistance Pin
CHill607-Apr-21 0:57
mveCHill607-Apr-21 0:57 
AnswerRe: Excel Spreadsheet To Database Migration Assistance Pin
Mycroft Holmes7-Apr-21 12:54
professionalMycroft Holmes7-Apr-21 12:54 
QuestionSQLite query Pin
David Crow23-Mar-21 10:02
David Crow23-Mar-21 10:02 
AnswerRe: SQLite query Pin
k505423-Mar-21 14:42
mvek505423-Mar-21 14:42 
GeneralRe: SQLite query Pin
David Crow23-Mar-21 16:10
David Crow23-Mar-21 16:10 
AnswerRe: SQLite query Pin
Richard Deeming23-Mar-21 23:31
mveRichard Deeming23-Mar-21 23:31 
GeneralRe: SQLite query Pin
David Crow24-Mar-21 3:16
David Crow24-Mar-21 3:16 
QuestionDisallowed implicit conversion from data type smalldatetime to data type float Pin
jkirkerx18-Mar-21 11:56
professionaljkirkerx18-Mar-21 11:56 
AnswerRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
Victor Nijegorodov18-Mar-21 21:15
Victor Nijegorodov18-Mar-21 21:15 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jkirkerx19-Mar-21 6:58
professionaljkirkerx19-Mar-21 6:58 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jsc4219-Mar-21 7:45
professionaljsc4219-Mar-21 7:45 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jkirkerx19-Mar-21 8:54
professionaljkirkerx19-Mar-21 8:54 
Ok ...

The dates stored in the database are like 3/1/2021 as smalldatetime
But I'm asking to compare against 2021-03-01, an ISO date, so wrap what I'm asking to compare to.

I came up with this ...
$query = "
SELECT 
  count (a.project_no) 
FROM project as a, commission_summary as b   
WHERE a.project_no = b.project_no
AND (a.sold_date <= '$lastDate')
AND (a.status = 'construction' or a.status = 'finished')
AND (convert(CHAR(10), b.startup_check_date, 120) BETWEEN '$firstDate' AND '$lastDate')   
AND a.sales_no = '$salesId'";

I fiddled with the conversion, and was sure I got it right but it failed. Then I used the suggestion to wrap the dates in single quotes and it produced a clean result of 9.

I get the convert part, declare a CHAR no more than 10, input value, ?
Not sure what the 120 stands for.
However your explanation of the date formats has schooled me in how to fiddle with them and get it right.

Just FYI, I wrote some other fixes earlier that are similar, and just had a complete blackout of my previous experiences. But this lesson should solidify it. Thanks!
If it ain't broke don't fix it
Discover my world at jkirkerx.com

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.