Click here to Skip to main content
15,881,089 members
Home / Discussions / Database
   

Database

 
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

GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jsc4219-Mar-21 11:17
professionaljsc4219-Mar-21 11:17 
GeneralKearning Python Pin
Lumbeta Aquirok17-Mar-21 23:50
Lumbeta Aquirok17-Mar-21 23:50 
GeneralRe: Kearning Python Pin
Richard MacCutchan18-Mar-21 0:01
mveRichard MacCutchan18-Mar-21 0:01 
QuestionSystem.NullReferenceException: Pin
H. Martins23-Feb-21 14:28
H. Martins23-Feb-21 14:28 
AnswerRe: System.NullReferenceException: Pin
Richard MacCutchan23-Feb-21 22:04
mveRichard MacCutchan23-Feb-21 22:04 
GeneralRe: System.NullReferenceException: Pin
Richard Deeming23-Feb-21 22:19
mveRichard Deeming23-Feb-21 22:19 
GeneralRe: System.NullReferenceException: Pin
Richard MacCutchan23-Feb-21 22:31
mveRichard MacCutchan23-Feb-21 22:31 
QuestionGeneral advice about simple table storage. Pin
H. Martins19-Feb-21 9:34
H. Martins19-Feb-21 9:34 
AnswerRe: General advice about simple table storage. Pin
Eddy Vluggen20-Feb-21 7:04
professionalEddy Vluggen20-Feb-21 7:04 
GeneralRe: General advice about simple table storage. Pin
H. Martins21-Feb-21 3:26
H. Martins21-Feb-21 3:26 
GeneralRe: General advice about simple table storage. Pin
NotTodayYo12-Mar-21 7:17
NotTodayYo12-Mar-21 7:17 
GeneralRe: General advice about simple table storage. Pin
Eddy Vluggen13-Mar-21 6:09
professionalEddy Vluggen13-Mar-21 6:09 
QuestionWITSML Server And Client in C# Pin
Member 1332584614-Feb-21 21:54
Member 1332584614-Feb-21 21:54 
AnswerRe: WITSML Server And Client in C# Pin
Richard MacCutchan14-Feb-21 22:21
mveRichard MacCutchan14-Feb-21 22:21 
GeneralRe: WITSML Server And Client in C# Pin
Member 1332584614-Feb-21 22:53
Member 1332584614-Feb-21 22:53 
Generalneed website to create database Pin
Member 150643285-Feb-21 12:51
Member 150643285-Feb-21 12:51 
QuestionRe: need website to create database Pin
Eddy Vluggen5-Feb-21 13:09
professionalEddy Vluggen5-Feb-21 13:09 

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.