I'm using this plugin with Mijoshop.
Unknown column 'cg.name' in 'field list' SQL=SELECT ps.*, cg.name FROM
n6175_mijoshop_product_special ps LEFT JOIN
n6175_mijoshop_customer_group cg ON
cg.customer_group_id=ps.customer_group_id WHERE ps.product_id BETWEEN
24 AND 719 ORDER BY ps.product_id, name, ps.priority
I am getting this error when I want to export data. Been working correctly before, suddenly gives an error.
Kind regards.
Related
Trying to set up a dashboard to keep an eye on my hardware. I am running into issue with the without(cpu) causing an error.
avg without(cpu) irate(node_cpu_seconds_total {instance="nodeexp:9100", job="nodeexp", mode!="idle"} [1m])
The error I get with this query is error:"1:18: parse error: unexpected identifier "irate" in aggregation"
I have also tried it this way.
avg(without(cpu) irate(node_cpu_seconds_total {instance="nodeexp:9100", job="nodeexp", mode!="idle"} [1m]))
The error I get with this query is error:"1:12: parse error: unexpected "(" in aggregation"
Not sure what I am doing wrong here. Any help would be appreciated.
I was able to figure it out.
avg without(cpu) (irate(node_cpu_seconds_total{instance="nodeexp:9100", job="nodeexp", mode!="idle"}[1m]))
$shop=DB::table('shops')
->leftJoin('orderbookings',function($join)
{
$join->on('shops.id','=','orderbookings.shop_id');
$join->on('orderbookings.created_at','>=',DB::raw(date("Y-m-d",strtotime("now"))));
})
->select('shops.*')
->selectRaw('COUNT(orderbookings.id) as totalorder, SUM(orderbookings.grand_total) as gtotal')
->orderBy('shops.shop_name', 'asc')
->groupby('shops.id')
->paginate(10);
Above code working fine(But not giving total order and amount correct) and also gives result almost close to what I want,
But I am not able to give date format (Y-m-d H:i:s), it shows syntax error. I am using Laravel 5.2 version
Note: I want to give time as well with date to rectify result,
On giving [example: 2017-03-08 11:15:00] shows syntax error
working query in mysql
SELECT COUNT(orderbookings.id), SUM(orderbookings.grand_total), shops.shop_name FROMshopsLEFT JOIN orderbookings on orderbookings.shop_id = shops.id and orderbookings.created_at BETWEEN "2015-10-22 17:02:02" AND "2017-03-07 17:02:02" GROUP BY shops.id
But not able to to convert in eloquent
You should be able to do the following:
$join->on('orderbookings.created_at', '>=', date("Y-m-d"));
You don't need to use DB::raw, and leaving the second parameter null for date, assumes "now".
If this doesn't solve your issue, please post the exact error you're seeing.
I get this error when trying out this command in the BIRT Classic Models sample database in Data Studio
select xmlelement(name "custno", customers.customernumber) from customers
Syntax error: Encountered "\"custno\"" at line 1, column 24.
I do not know how to correct it.
Thanks.
I'm not familiar with db2, but according to this your statement looks quite alrigth (although I'd place an alias to name this field...)
But this
Syntax error: Encountered "\"custno\"" at line 1, column 24.
seems to be a quite clear hint, that your error is connected to the NAME of the element.
I'm pretty sure, that this statement was created on string level.
Did you try to escape the "-characters with \"?
The SQL reaching the engine might look like
select xmlelement(name \"custno\", customers.customernumber) from customers
or
select xmlelement(name "\"custno"\", customers.customernumber) from customers
... which is wrong of course...
But to be honest: just guessing...
I've been having trouble with eloquent that keeps returning error. Below is the query that i tried to run in laravel.
$actives = ProjectVersion::join('version_employees as ve', 've.report_id' ,'=', 'project_versions.id')
->join('employees as e', 've.employee_id', '=', 'e.id')
->whereBetween(\DB::raw("'1985-05-27'::date"),[
\DB::raw("to_date(timeline->>'start_time', 'YYYY-MM-DD')"),
\DB::raw("to_date(timeline->>'release_time', 'YYYY-MM-DD')")])
->groupBy('e.name')
->select(\DB::raw('count(e.id), e.name'))
->get();
Now this returns an error of
Invalid datetime format: 7 ERROR: invalid input syntax for type date: "to_date(timeline->>'start_time', 'YYYY-MM-DD')"
The full query returned by the error message is
SELECT count(e.id), e.name
FROM "project_versions" inner join "version_employees" as "ve" on "ve"."report_id" = "project_versions"."id" inner join "employees" as "e" on "ve"."employee_id" = "e"."id"
WHERE '1985-05-27'::date
BETWEEN to_date(timeline->>'start_time', 'YYYY-MM-DD')
AND to_date(timeline->>'release_time', 'YYYY-MM-DD')
GROUP BY "e"."name"
The thing is that when i run this query in pgadmin, it runs fine and returns the result that i wants.
I've been stuck for hours debugging this. Any idea on where the problem is ?
Well first off, it's not really eloquent in the way you're using it with all those Raw statements ;-)
Try using the Carbon class: Carbon::now()->toDateString() will return a date in the Y-m-d format.
For the where clause, if I'm understanding your query correctly, you can use 2 where clauses instead of the whereBetween with Raw SQL: ->where('start_time', '>', $start_time_preprocessed_by_carbon)->where('release_time', '<', $release_time_preprocessed_by_carbon)
And you seem to want the count which means you can end with a ->count() instead of a ->get()
I'd love to give you the full query but couldn't decipher it completely. However these implementations should give you a nudge in the right direction! They will help you abstract your query further to the point that Laravel's internal query generator will translate the code into the correct syntax for your database!
I have a program that is dependant on PostgreSQL, It is suddenly giving me the error
SQLSTATE[22007]: Invalid datetime format: 7 ERROR: invalid input syntax for type time: "00:00:01."
LINE 1: ...:55:02.027392', '00:00:00.042608', '00:55:02.07', '00:00:01....
It occurred after loading some data into a folder that is monitored for changes to update the database. I have since removed ALL the data from that folder. I have searched for several hours, I am unable to find anything giving me direction where to start.
postgresql-9.1-main.log
2015-04-05 12:26:15 EDT ERROR: invalid input syntax for type time: "00:00:01." at character 234
2015-04-05 12:26:15 EDT STATEMENT: INSERT INTO cc_schedule (starts, ends, cue_in, cue_out, fade_in, fade_out, clip_length, position, instance_id, file_id, stream_id) VALUES ('2015-04-06 17:00:00.000000', '2015-04-06 17:55:02.027392', '00:00:00.042608', '00:55:02.07', '00:00:01.', '00:00:01.', '00:55:02.027392', 0, 25, 1717, null) RETURNING id
I would appreciate any advice. I am thinking there is just a bungled entry somewhere that could be removed? or do I need to reinstall PostgreSQL ?
you have two time entries with a dot at the end of time, that cause the error:
00:00:01.
fix the data to
00:00:01
I found the issue, I had changed a configuration as related to Track Fade time. When doing so from "0.50" to "1." leaving . at the end bungled it. Thank You for your time and assistance.