I’m trying to convert a sql query to a Laravel Query builder, but i find hard understand which is the best way for FORM SUBQUERY in Laravel, because if i’m not wrong, is not something that you can normally do whit query builder, but you should implement in raw. is this right? and how should transl…
Tag: sql
How To use multiple columns
I’m trying to get a result : does not work for me, any help Answer You can use GROUP_CONCAT for that purpose day | kine | color –: | :—- | :—————– 1 | 1,2 | white,orange 2 | 1,2,3 | White,Orange,White db<>fiddle here
Is there a way of getting a proportional section of an SQL table?
I’m trying to split a single query into 4 parts, for readability purposes. Having it as a single query, while adequate, isn’t “pretty” for display purposes. An example would be a query that …
How to combine multiple sqlite queries into one line
Sorry if this question is dumb. i am a beginner and for the past hour i’v been searching the internet for answer and i haven’t found one(maybe because i am bad at searching). Anyway, i am writing a …
PostgreSQL Transform Geometries
I have a table full of Easting/Northing points that I want to transform into a column in SRID:27700. I’m using Postgres with postgis installed. I’m trying this: Of course this returns the locations in easting/northing, but when I try to first transform the points using ST_Transform, it returns SQL…
Keyword IF not expected
I have the following inline SQL code, running on an AS400. The IF comes up as unexpected but I don’t understand why. What I’m trying to do is to build a stored procedure to update, or insert, a …
How to delete some observations in some groups based on a condition
I would like delete some observations in some groups based on a condition. My condition is each group : if (imput=”toto”) then delete but if a whole group has imput=”toto” then …
SparkSQLContext dataframe Select query based on column array
This is my dataframe: I want to select all books where the author is Udo Haiber. but of course it didn’t work because authors is array. Answer You can use array_contains to check if the author is inside the array: Use single quotes to quote the author name because you’re using double quotes for th…
SQL – combine rows conditionally on the value of previous row
My issue I believe is best explained by using an example: Sample Data SO Customer Product Description Quantity Extension Country 01 xxx 123 Product A 01 20.00 USA 02 yyy 456 Product B 02 25.00 China 02 yyy 456 Product B 01 12.50 China 02 yyy 789 Product C 01 50.00 Mexico 03 zzz 789 Product C 01 50.00 Mexico
Adding all values from output SQL
So, i have a query which looks like this: And it gives me back: Is there any way that this query will give me back added value? Just number 860. Kindly please help me :/ Answer You can just sum all the points you got from your query: