Copybase.odbYes it is a query with over 5000 records, and I want to select between 2 date ranges each month.
Thanks, but when I used this:
SELECT “ReadingDate”.DATE
FROM “tblWXdataLeeds”
WHERE DATE between ‘01-04-2017’ And '30-04-2017
I get a syntax error with nothing to say where it is exactly. I added it underneath the existing SQL of the query
The ReadingDate is a heading with a list of dates in the column, and the tblWXdataLeeds is just that, a table
For the moment, there are too many things against me to learn SQL now and apart from LO dbase crashing on me every time I have made a change to one of the forms or queries, I thank you for the help you have given so far, but SQL is a world I am not familiar with, so I’ll go back to Access for the time being.
I have put this into a SQL command in LO
SELECT “tblWXdataleeds”.“ReadingDate” From “tblWXdataLeeds” WHERE “ReadingDate” between ‘2017-04-01’ And ‘2017-04-30’
The status is:
2: Column not found: tblWXdataleeds.ReadingDate in statement [SELECT “tblWXdataleeds”.“ReadingDate” FROM “tblWXdataLeeds” WHERE “ReadingDate” BETWEEN ‘2017-04-01’ AND ‘2017-04-30’]
But if I use this:
SELECT “ReadingDate” From “tblWXdataLeeds” WHERE “ReadingDate” between ‘2017-04-01’ And ‘2017-04-30’
The status is
1: Command successfully executed.
So now I have to figure out where to put that line into the existing SQL for the query.
Ok, I have just tried this:
SELECT “WXdataleeds”.“ReadingDate” From “tblWXdataLeeds” between ‘2017-04-01’ And ‘2017-04-30’, and still getting the syntax error message.
The dates in the table are of the UK format ie: 01/04/2017
Apologies for the formatting of my replies, and hope this makes it more readable.
I have copied the existing SQL from the said query to make it more readable for me:
SELECT DISTINCT
“ID1” AS “ID1”,
“ReadingDate” AS “ReadingDate”,
“TempMaxC” AS “TempMaxC”,
“TempWindChillC” AS “TempWindChillC”,
“TempMinC” AS “TempMinC”,
“RainFall” AS “RainFall”,
“Pressure” AS “Pressure”,
“RH” AS “RH”,
“WindGust” AS “WindGust”,
“WindSpeed” AS “WindSpeed”,
“Direct” AS “Direct”,
“CloudAmnt” AS “CloudAmnt”,
“CloudType” AS “CloudType”,
“Conditions” AS “Conditions”
Then I added the WHERE clause
WHERE “ReadingDate” between ‘01/04/2017’ And ‘30/04/2017’
FROM
“tblWXdataLeeds”
That returned this status error:
1: Unexpected token WHERE, requires FROM in statement
Do I need to use another FROM, or have I put the WHERE clause in the wrong place.
This on it’s own doesn’t give what I want, as it for now just gives all the dates in the ReadingDate column, over 5000 of them
SELECT “tblWXdataLeeds”.“ReadingDate” FROM “tblWXdataLeeds” WHERE “ReadingDate” BETWEEN ‘01/04/2017’ AND ‘30/04/2017’
Ok, I have now added the WHERE after FROM:
FROM “tblWXdataLeeds” WHERE “ReadingDate” BETWEEN ‘01/04/2017’ AND ‘30/04/2017’
and that gives me every record, which I don’t want
The reason for the AS is because that is how dbase built the query when it was created with the wizard, and I just copied and pasted it.
Thanks
Using the internal date of YYMMDD gives no results at all, as the date format I use in the UK is DDMMYYY, which gives every record.
Yes I did specifically use the internal date, or USA date as we call it but no records were found. All the cells under Reading Date have the date as DDMMYYY.
This is the SQL in the said query which currently gives all and every record of dates:
SELECT “ReadingDate”,“ID1”, “ReadingDate” , “TempMaxC”, “TempWindChillC” , “TempMinC” , “RainFall”, “Pressure” , “RH”, “WindGust” , “WindSpeed” , “Direct” , “CloudAmnt” , “CloudType”, “Conditions” FROM “tblWXdataLeeds” WHERE “ReadingDate” BETWEEN ‘01/04/2017’ AND ‘30/04/2017’
If I invert the dates, then no records are found.
I copied and pasted what you asked me to use into the line of SQL and exactly how you wrote it. This gives NO results whatsover. To me it is something else which isn’t correct somewhere, unless of course it can’t be done anyway.