返回首页
We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [where-clause]

A syntactic form in functional languages used to bind a value to a name in a local scope. Similar, but not identical to, let.

Filter by
Sorted by
Tagged with
0
votes
0answers
26 views

Rails - Where condition on array of ids doesn't run the whole array

In my application, I'm doing a where condition in my user model with ids (around 1000 ids) as below: ids = "1,2,3,4,5,6,... # to 1000" users = User.where(id: ids.split(',').map(&:to_i) ) Ruby ...
0
votes
0answers
10 views

How does an `IN` instruction affect Druid SQL requests?

The Druid Documentation of the IN Filter does not say anything about efficiency. We're having problems with one SQL statement which keeps timing out and I think that the main culprit would be the ...
1
vote
1answer
35 views

JDBC returns null value in resultSet using where condition. I tried to get all columns but its not returning any value

I want to get all the data from the database using a where condition. But resultSet returning null values. But when I use an Integer instead of string it works fine, but that I don't want. I'm not ...
0
votes
1answer
41 views

Is there a way to query SQLite db with a WHERE clause that doesn't always have all attributes set?

I'm building a Java desktop application and use SQLite for my database. I want the user to be able to see results from the same table depending on a number of combinations of parameters, but they ...
-1
votes
2answers
17 views

Laravel where query not geting all value (can't get null value)

I have a table called tb_user with multiple fields, 1 of them is id_company. When showing the user list, admin can set whether they want to see all users or specific users with selected id_company. ...
0
votes
0answers
36 views

In SQL I need to know how to show all of a specif value based on a column

I have to run a leads report with very specific criteria however one of the criteria is that I anything with a 'P' in c.LN#DISP no matter what to show while also only pulling anything with an 'A' or '...
1
vote
2answers
26 views

How to get all records before any specified month in mysql

I want to select all records before any specified month using mysql. Here is my attempted statement: SELECT SUM(amount) as allPreviousAmount FROM `fn_table` WHERE MONTH(transdate) < 1 AND YEAR(...
0
votes
1answer
53 views

how to call a function multiple times with where clause in php pdo?

I am new to php and trying hard to learn its why you guys and gals need to Forgive me for asking a lot! Here is my question; I am trying to call a function with where clause multiple times, I have ...
0
votes
2answers
36 views

How to SELECT timestamp for every 5 minutes from date in MS SQL Server?

I'm using MS SQL Server and I need SELECT that return only data like: SELECT TOP 100000 [timestamp], [value] as fi500 FROM X where timestamp>='2019-11-05' + 5 minute order by timestamp So I got: ...
0
votes
1answer
49 views

Returning IS NOT NULL in SQL CASE WHEN expression

How can I return IS NOT NULL on from a SQL Server CASE statement? I have tried something like this: WHERE a.BillToCustomerID IS NOT NULL AND CASE @taxSchedRequiered WHEN 1 THEN ...
0
votes
3answers
69 views

WHERE clause, probably simple but i cant see it

I have a SQL where clause question that I hope you can help me with. I am trying to filter the results of my product database query to not retrieve specified products types where the stock received ...
0
votes
2answers
42 views

I need help making a where clause with several pieces of criteria work

I have joined 6 tables to gather all of the information needed and am trying to use the where clause to filter the records I need with there corresponding information. However when I put the criteria ...
0
votes
1answer
60 views

Is NOT IN the same as <> in this context?

Within the where clause of an SP I'm working on, I'm trying to filter out rows where there are matching IDs. Are there any differences in the below? Are there any benefits to either method? (I imagine ...
0
votes
1answer
27 views

MySQL How to use and OR inside an AND operator for a where clause?

I'm trying to use AND with OR's inside my WHERE clause but I'm not getting expected results. This is my query: select * from Pitches where BatterID = @playerID and YEAR(GameDate) in (2019) ...
-1
votes
2answers
37 views

Comparing date values in where clause

I am trying to get the current month records from a table. Since this is going to be an automated monthly job, I can't give explicit values in where clause. So I am using the intnx function to get the ...
0
votes
0answers
20 views

How to pass lists as variables into where in clause (SQL Server)

I am trying to make a query like this dynamic using variables in SQL Server. Original Query (returns results) select * from items where [key] in ('material', 'type') and value in ('nylon/latex', '...
-1
votes
1answer
14 views

SQL Update update query error when updating with conditions of another table

I have 3 tables with the following schema: appointment(VAT_doctor,date_timestamp,description,VAT_client) VAT_doctor: FK(doctor) VAT_client: FK(client) employee(VAT,name,birth_date,street,city,zip,...
0
votes
1answer
31 views

Laravel pagination fails with more than one where clause

I want to paginate the result of this query. Pagination works fine when I call where() only one time, but like in the code below, it fails when there are multiple ->where() method calls. If i remove ...
0
votes
0answers
27 views

Using the same date for two different variables

I have two variables inside a stored procedure, which are manually populated when the SP is executed: @ForEmployeeUpdatedDays @IncludeDocumentAgeDays Example of what I'm trying to achieve: When @...
0
votes
1answer
29 views

Laravel where() inside a whereHas() access other side table column

Sorry for the messy title, i didnt knew how to describe it. So i got three tables tables in re model: students, groups, and the table that relates them called courses. Im trying to get every "student"...
0
votes
3answers
36 views

How Can I Get All Rows Using IN Subquery if the Subquery Returns No Rows

I have a query like this; SELECT * FROM A WHERE ID IN( SELECT ID FROM B WHERE STATUS=1 ) I want to get all rows if sub query is null How can i do this?
1
vote
1answer
38 views

How can we concatenate multiple results filtered through 'where' statement in SQL

There are two tables look like: financials: policy_id state coverage earned_premium_dollar_amount 1 OH bi 1.7 1 OH umuim 0.82 2 ...
-1
votes
0answers
21 views

Compare two data rows and highlight exact unmatching field

I have extracted not matching row into third data table using LINQ query, but i want to highlight exact field that is not matching.
0
votes
0answers
12 views

How to exclude blank rows while printing a html table using php

I have an HTML table which consists of the subjects and teachers that teaches them but there are some students that don't offer some subjects and I would like to exclude them when printing the results....
1
vote
1answer
37 views

Is there a way to filter by a value in an array of strings using SQL API in Cosmos DB?

I am new to SQL API. I'm trying to write queries for documents like this: { "School" : "ABC Elementary" "Grades" : [ { "gradeLevel" : "First", "subjects" : ["Drawing", ...
0
votes
0answers
23 views

Mysql select where procedure=1

I have procedure "CheckStatus" which returns 0 or 1. How I can use this query without HAVING? It's not work properly with limit 0,10 - it filtering rows with status=0 and I never got 10 results as I ...
0
votes
0answers
35 views

symfony 4 doctrine createQueryBuilder with andWhere

I need help with Symfony 4 and Doctrine (Repository) for beginner. In my method findChildrenValidAndNotExpired i am trying to get children articles of category. This give me all related articles to ...
0
votes
3answers
29 views

How to get 'IS NULL' where clause values if initial condition returns none in oracle

I have a table with values as follows ![ID S_ID NAME 1 James 2 2455 Patrick 3 2566 Sam 4 25988 Rick]1 My requirement is to get the NAME based on S_ID and if the given ...
-1
votes
0answers
39 views

Mysql query in the for loop (Using math)

I have this query who returns of course an parse error: for($x=0; $x<4; $x++) { $sql = "UPDATE table SET city = '$cities[$x]' where country = 'Country$x+1' "; $result = $site_db->query($sql); }...
0
votes
1answer
15 views

Mysql Stored Procedure: match the column rule to retrieve value

I have a stored procedure which function to retrieve the ColumnProperty based on the input parameter matching the ColumnRule. For example, I will execute the below to get the ColumnProperty as ...
1
vote
0answers
38 views

Function only available for parameter property

Is it possible to have a function available only when the property of a parameter meets a certain condition? For example, by using the where keyword? I gave an example of the idea below. struct ASN1 {...
-1
votes
2answers
71 views

Where clause using alias on one column of a table

I am trying to fetch some results using one column from a table, based on certain condition the results should be fetched. Below is an query output: This is reference data for my question below. ...
0
votes
0answers
19 views

Error with WHERE (a OR b) AND (c OR d) clause [duplicate]

I have a MySQL statement that is erroring when it should perform smoothly. I have a WHERE clause with an AND statement where both elements of the AND statement have their own OR statements. I've ...
0
votes
4answers
31 views

Update multiple records based on 1 record meeting a criteria

I am trying to Select all records from a dataset where 1 of the records meets a criteria. I have a table of data that contain the hours worked by a person by day. I need to select all the records for ...
1
vote
2answers
30 views

How I can extract year from a date in sql and use it in where clause

I have a date column in a table which is named released_date and the format of its data is for example: 01-Jan-1995. I want to have just the years which are greater than 1997. Does anybody know how I ...
0
votes
2answers
67 views

SELECT, WHERE, GROUP BY

I'm trying to retrieve data that shows me if a card has been given to a player. I've tried different ways of structuring the code using these sites are resources http://www.sqlservertutorial.net/...
-1
votes
3answers
42 views

How can I use a calculated value in the WHERE clause?

I have the following SQL: SELECT members.id, FLOOR(DATEDIFF('2019-10-25', crew_cv.dob) / 365.25) as age FROM members JOIN crew_cv ON members.id=crew_cv.user_id WHERE members.active=1 AND age>20 ...
0
votes
3answers
28 views

MySQL full join query displaying records that do not fit criteria

I am building a hotel reservation system in C#, as a portfolio project to show employers when I get out of college. My main form has a Month Calendar object, that once a date is clicked, it will ...
0
votes
1answer
37 views

Snowflake - Query Last 12 Months of Data

How would I pull the last twelve months of records without using Between? I've attempted variations of the following in my where clause : DATEADD(YEAR,-12,O.CREATEDATE) & TO_DATE(O.CREATEDATE)&...
0
votes
2answers
20 views

Microsoft SQL Server MAX return

I'm trying to return the first_name, last_name, and height of the tallest female(s) in a table. SELECT height, gender FROM students WHERE gender = 'F' ORDER BY height ASC I did this to find out what ...
2
votes
1answer
47 views

Maximo List View: Filter where field is null OR equals value?

I have a division field in Work Orders in Maximo 7.6.1.1. I would like to filter the work orders in the List View where division is null or division = 'FORESTRY'. Is it possible to do this in the ...
0
votes
0answers
41 views

InfluxDB subquery and where clause

I'm attempting to operate a where clause on a resultset, I think it should work (according to the InfluxDB website) however, it isn't. The query looks like; SELECT (cumulative_sum(mean("ap"))/1000*24 ...
0
votes
1answer
23 views

Oracle SQL find unique id by date

Hello Experts, I am running Oracle 12c on Windows. I have made a query to find any new id's and the date they were entered. I wanted to know how you would change the query to include an exact date ...
0
votes
1answer
22 views

How do I create a subquery linking to 3 tables?

Basically, I need to create a subquery that filters a movie database records. I need to retrieve movies that are spoken in Japanese ('ja') and have the genre('action'). Each time I run the code below ...
-1
votes
2answers
50 views

SQL Select Max Count Nested?

SELECT N.National_PosID, N.Title, C.First_Name, C.Mid_Name, C.Last_Name, count(*) FROM National_Position N, Candidate C, Vote V WHERE N.National_PosID = C.National_PosID AND V.Candidate_ID = C....
0
votes
3answers
38 views

MySQL where IN from joined table

i have 2 tables (example): product: | id | name | | 1 | product1 | | 2 | product2 | | 3 | product3 | product_categories: | product_id | ...
0
votes
1answer
18 views

How to combine criteria in a WHERE clause with AND (POSTGRES)

I need to meet two criteria to select data from a table then meet a separate third criteria. The issue I seem to be running into is that I can't seem to "group" (for lack of a better term) the first ...
2
votes
1answer
28 views

Invalid condition in a MySQL UPDATE's WHERE clause - updated EVERYTHING - instead of NOTHING

What I meant to write: UPDATE items_ordered_list ords SET ords.last_ordered='2019-10-16 10:49:23' WHERE ords.cust_id='11656165'; What I actually wrote: UPDATE items_ordered_list ords ...
0
votes
1answer
25 views

MySQL Question - Find the title and year of each movie that someone rated with 5 stars and someone else rated with fewer than 3 stars

I am provided three tables, one called Person which has an id (primary key) and name attribute, a Movie table with title, year (where title and year together are the primary key) and finally a Saw ...
0
votes
0answers
37 views

How can I put multiple checkbox results in a WHERE clause in SQL?

I need to write a WHERE clause against a varied number of categories in my database. How would I best approach this? This is what I'm doing: I am creating a search page to display results from my ...

返回首页
杏彩计划 杏彩官网 杏彩APP 杏彩走势图 杏彩下载 杏彩官方 杏彩网站 杏彩怎么玩 杏彩官方 杏彩靠谱吗 杏彩代理 杏彩骗局 杏彩投注 杏彩倍率 杏彩开奖 杏彩漏洞