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
1 answer

csh script: check if command exists

I would like to have something like this if (command_not_exists) exit Can someone tell me how to achieve this functionality in a cshell script?
BluVio
  • 449
  • 1
  • 5
  • 11
2
votes
4 answers

mysql where condition

I'm interested in where condition; if I write: Select * from table_name where insert_date > '2010-01-03' and text like '%friend%'; is it different from: Select * from table_name where text like '%friend%' and insert_date > '2010-01-03'; I…
ignas
  • 371
  • 1
  • 6
  • 13
2
votes
1 answer

Query parent and child entries of one element in a single row

I'm searching for the best way to display parent and child entries in one row. Example: Table A ID | PARENT_ID | VALUE ============================= 1 | | A 2 | 1 | B 3 | 2 | C 4 | …
road242
  • 2,492
  • 22
  • 30
2
votes
3 answers

Joining Multiple Tables in SQL Server 2008 causes error

I am writing a query to join 3 tables, I have the following tables: Apn [ID, QualHolderID, RecvDate, Barcode] QualHolder [ID, Surname, FullName, DOB, ResCountryID, Gender] Country [ID, Name] Gender [ID, Name] I wrote the following SQL statement to…
kya
  • 1,798
  • 8
  • 35
  • 61
2
votes
1 answer

Use the result of a Subquery in WHERE CLAUSE

I'm try to use the result of a subquery in the query's WHERE clause. The attribute I am wishing to use is last_contact. See below. SELECT forename, surname, type, ( SELECT MAX(completed_date) FROM tblTasks WHERE…
Adam92
  • 436
  • 8
  • 23
2
votes
3 answers

SQL update a table

TABLE 1 id name uf ibge 1 GOIANIA 'GO' null 2 BRASILIA 'DF' null 3 TOCANTINS 'TO' null TABLE 2 id name uf ibge 1 GOI**Â**NIA 'GO' 5208707 2 BRAS**Í**LIA …
Pablo Aquino
  • 73
  • 2
  • 11
2
votes
2 answers

SQL; Functions and where clause

I'm trying to figure out which country has the population that is closest to the global average country population. I have the following relation; Column | Type | Modifiers ------------+-----------------------+----------- …
Stabbah
  • 73
  • 10
2
votes
2 answers

WHERE clause in .cshtml MVC 4

I have 3 tables in my database: Categories: ID(PK), CreationDate Languages: ID(PK), Title CategoryDetails: ID(PK), CategoryID(FK), LanguageID(FK), Title, Description I've also created a ViewModel in MVC 4 with all the tables, but when I'm trying…
Stiliyan Vasilev
  • 179
  • 2
  • 3
  • 14
2
votes
3 answers

How to write conditions in a WHERE clause?

The request is 2 part: Records should fall off report _*If the Record has expired AND if *_RecordStatus != 'Funded'. Records should stay on the report _If RecordStatus = 'Funded'*, has no *PURCHASEDATE, and if the Record has expired (is in the…
2
votes
5 answers

How to create a sql script to consider two columns?

Lets say today's date is Jan 22, 2014 and i run a report having this table below (Table) but input range of SIdate from Jan 01, 2014 to Jan 18, 2014 only. I want to display all rows based on the SIdate i entered which is jan 01,2014 to Jan 18,…
user1840952
  • 69
  • 4
  • 11
2
votes
4 answers

Mysql error not following where condition

Why is this sql giving tables with minimum field having null. Also when A has no data between the given date ranges, it is providing the table with all rooms having minimum as null SELECT `rooms`.*,A.`minimum` FROM ( SELECT…
Bishal Paudel
  • 1,896
  • 2
  • 21
  • 28
2
votes
1 answer

mysql query request from two tables with IN clause

I have mysql tables: 1. ms_fields id name 1 Color 2 Gender 2. ms_fields_values id fieldsid value ordering 1 1 White 0 2 1 Black 1 3 1 Orange 2 4 1 Green 3 5 1 Blue …
XTRUST.ORG
  • 3,280
  • 4
  • 34
  • 60
2
votes
1 answer

laravel whereraw with where in statement

I'm trying to use a WHERE IN statement in the query builder using whereRaw but it doesn't seem to work. I'm not trying to select values from other tables though, just selecting from multiple values. I've tried these 3 approaches: return…
Björn Andersson
  • 855
  • 3
  • 11
  • 23
2
votes
2 answers

sql query - IF EXIST in WHERE clause

I have a query as like SELECT * FROM aTable LEFT JOIN aTableTranslate ON aTable.id = aTableTranslate.aTable_id WHERE aTableTransalte.language like 'en' question is .... is there any way to filter as like ... WHERE aTableTranslate.language like…
user2660234
  • 67
  • 2
  • 8
2
votes
2 answers

CASE statement inside a WHERE clause in SQL Server

I am trying to add a CASE statement, but I need an OR within it and I am having a little trouble. I'm not sure how I can do this, but I was hoping someone could help. Here is what I am trying to do: SELECT * FROM Table1 WHERE IsUpdate = CASE WHEN…
rjbogz
  • 860
  • 1
  • 15
  • 36
1 2 3
99
100