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.

9069 questions
2
votes
2 answers

numpy 2d array operation, keeping certain positions

I have two 2d numpy arrays: X2d = np.array([[0,4,5,0], [7,8,4,3], [0,0,9,8]]) Y2d = np.array([[1,0,4,8], [0,3,8,5], [0,6,0,8]]) #and I would like to get these two: X2dresult =…
Qfwfq
  • 185
  • 1
  • 7
2
votes
1 answer

Build string for Linq WHERE clause depending on multiple checkbox choices

I can build the WHERE clause with a varying number of "AND"s in a string in PHP and then concatenate it to the end of my SELECT statement before running. I am trying to figure out how to do this in MVC Controller ActionResult event using…
JustJohn
  • 1,362
  • 2
  • 22
  • 44
2
votes
5 answers

mysql where clause dosnt work

i have this MySQL query to retrieve some data just for those who have language = 3 SELECT noor_content.id,noor_content.body,noor_content.category,noor_content.introtext,noor_content.title,noor_content.keywords,noor_content.language,path FROM…
Bahrami-Reza
  • 608
  • 2
  • 7
  • 24
2
votes
1 answer

Search a database and show results even if the search term is spelled wrong?

I have a search function on a page that when the user types in a search term when submit is pressed it checks the database and shows appropriate records in the database (it uses a %Like% query) on the page. However the user may spell something…
Mikey Barker
  • 83
  • 1
  • 9
2
votes
3 answers

Can we use NOT IN on multiple columns?

I am creating a stored procedure (with Sql Server) involving a single table. I'd like to apply the conditions in my WHERE clause to a pair of columns. i.e. I would like something like this: CREATE PROCEDURE afficherCreationLuns (@start DATE, @end…
2
votes
2 answers

Using WHERE with SUM function SQL

SELECT imagename, SUM(ratingvalue) as "lol" FROM ratings GROUP BY imagename; How do I go about grabbing the total of a specific imagename so i can then display it onto the page, so for example instead of returning the results for all…
Emmett
  • 357
  • 2
  • 4
  • 15
2
votes
2 answers

Rails: finding records where attribute includes some value

I have a "Stores" model that contains various locations. Among the attributes for each store is the the "brands" that is carries. Example: Store1, brands: "Nike, Adidas, Polo"; Store2, brands: "Jcrew, Polo" I want to be able to select all stores…
dmt2989
  • 1,610
  • 3
  • 17
  • 30
2
votes
2 answers

Is WHERE clause applied before JOIN

Is it fair to say that a WHERE clause will be applied on the row before any joins are applied, whereas a HAVING clause will be applied on the final result set after all joins and all aggregate functions have been applied?
Victor
  • 16,609
  • 71
  • 229
  • 409
2
votes
4 answers

Laravel 4.x, Eloquent multiple conditions

I've tried to this: Product::where(['product_id' => $product->id, 'catalog_id' => $key])->first(); This isn't working at all. When I'm doing this: Product:where('product_id', $product->id)->where('catalog_id', $key)->first(); It just works fine.…
RonZ
  • 743
  • 1
  • 11
  • 31
2
votes
1 answer

UNIQUE NONCLUSTERED with WHERE clause in TABLE CREATE?

I am aware that it is possible to create UNIQUE constraints with a WHERE clause for a field in an existing table, but is it possible to create them in the CREATE TABLE statement? ie something like (I know this is invalid syntax): CREATE TABLE…
2
votes
1 answer

mysql query find multiple values in multiple rows?

I have the following case: one question, 5 possible answers to it. database has 5 columns for it where each column obviously can hold every answer in it, but always one-at-a-time and every answer only occurs in one column at-a-time. for instance i…
Dave33
  • 383
  • 3
  • 18
2
votes
2 answers

NoMethodError: undefined method `where' for main:Object (rake task) - Rails 4

I have a rails 4 app with a cron job that runs the following task once a day: task :update_packs => :environment do @all_users = User.all @all_users.each do |user| today = where(:created_at => (Time.now.beginning_of_day..Time.now)) …
zenben1126
  • 685
  • 1
  • 7
  • 25
2
votes
2 answers

MySQL SELECT FROM WHERE COUNT

Hi im looking for an MySQL Select that returns only that rows with doubled entries in column xxx example: +------+------+------------+--------------------+ | id | name | work_date | daily_typing_pages…
xQp
  • 302
  • 1
  • 5
  • 22
2
votes
1 answer

Comparing two LINQ queries, where statement Hasvalue vs !=null

I have this function has two requirements return only orders that have an OrderDate value other than null return orders that were placed in the year specified in the parameter year or later Which WHERE statement meets the requirements? And…
Fadi Alkadi
  • 781
  • 4
  • 12
  • 22
2
votes
2 answers

Combine two SQL Tables with a where Variable

Can't seem to get it right. I am trying to join two tables in my form and the WHERE is a variable taken from the URL (www.websiste.com?reference=38) Both tables have the same commonkey (ProgramCode) Table 1: programs: id_program | ProgramName | …
Ewald Bos
  • 1,560
  • 1
  • 20
  • 33