I have a graphql query like this: when i run this it expects a id as variable. How can I make that variable optional? It should display all results when no id is given Answer There’s no way that I’m aware to declare a variable as optional but also have it ignore the rest of the expression in the way
Tag: select
How to select data using like with out consider after character in laravel or sql
I have a table call labels_table. id label 1 A_1_1 2 A_1_2 3 A_2_1 4 A_4_1 5 A_10_1 6 A_11_1 I need to select all the labels for A_1 group. A_1_1 and A_1_2 should be the correct labels. I used the following query. sql Larval But both SQL and laravel queries returns all A_1_1, A_1_2, A_10_1 and A_11_1. But I
Simplification of SQL Query
SQL is not my specialty. I have a working query that accomplishes what I need it to, but I know there has got to be a cleaner way of accomplishing my goal. The query should return: – Name – Date of …
Select only products that are active via query from two tables
I have a query that provides me with a list of productId:s that I then match with a products table.. But how would I adjust the query to give me only productId:s that are active (active=1)? Answer You can use join:
SQL – How to select date from the past 5 years to include 1st of Jan of the oldest year
I am trying to select data entered for the past 5 years (to start from the 1st of Jan of the first or oldest year). I’ve constructed the query below but it does not begin from the 1st of January of the oldest year. Any help would be appreciated. Answer You seem to be using MySQL. The simplest method is
MySQL Workbench – SELECT is not valid at this position with this server version when using CASE WHEN statement [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 11 months ago. Improve this question When implementing a basic CASE WHEN statement in MySQL Workbench, I am getting the following error “SELECT is not valid at this
Select info from row to another row
I have this select on a view: And get this: And I want that the last row be like this: That is, the values of all columns equal to the other rows, except column ‘C’ and column ‘D’. The value of column D is obtained from T2.D How can I do? Thanks. Answer Without any sample data to use I
SQL query filter down to only applicable rows
How would I select a query like this? I am a bit confused because this would return nothing since any of the rows do not fulfill any of the “where clauses”.. What I would like is the answer …
How can I select data from last 13 months?
I have two tables with exactly same structure Now I need to ‘union all’ these two tables and I want only last 13 month data every time I run below query I have to run this every month and need only last 13 month data. How can I apply the filter? I have a date column ‘date’ in both the
Need help in framing SQL Query
TABLE-1 OrderDate CustomerNo ProductId Quantity 2021-03-01 1 1 10 2021-03-01 1 3 20 2021-03-02 1 2 15 2021-03-02 1 3 10 2021-03-03 1 1 10 2021-03-03 1 5 25 This table also contains data for other customers also Customers 2,3,4 … TABLE-2 ProductId ProductName 1 P1 2 P2 3 P3 4 P4 5 P5 Products are not Fixed, may be