Questions tagged [clause]
252 questions
6
votes
1 answer
How to write join with composite key clause in FSharp query expressions?
How to write this C# join with composite key clause in F#? :
join k in DataContext.Catalogs on
new { id = o.IDENT, v = o.VZ } equals
new { id = k.IDENT, v = k.VZ }
This is similiar question to this:
groupby multiple columns in a F# 3.0…

tomasK
- 358
- 1
- 3
- 14
5
votes
1 answer
How does Erlang index clause heads?
I come from a Prolog background. Prolog normally indexes on the first argument of a predicate (most decent systems allow you to change this around, index on multiple arguments, etc). At any rate, knowing how the engine indexes clauses allows you…

ultranewb
- 51
- 1
5
votes
1 answer
How to use like clause query in rails?
I wanted to get a json format of the data when searching for the keyword so I use LIKE clause and query like this
"select * from employees where fname like ? or mname like ? or lname like ? or username like ? or id like ?", str, str, str, str,…

MAC
- 676
- 3
- 13
- 32
5
votes
1 answer
MySQL ONLY IN() equivalent clause
I am giving a very abstract version of my question here, so please bear with me. I have a query that will check whether a particular body has certain multiple parameters of same type. Example, a boy has multiple selection as far as chocolates are…

Vijay Kumar Kanta
- 1,111
- 1
- 15
- 25
5
votes
2 answers
MySQL where clause and ordering by avg() as a sub query
Although I can group and order by on an aliased sub query, I can't use the alias in a where clause. Do I need to use a join instead?
Works:
SELECT entries.*,
(SELECT avg(value)
FROM `ratings`
WHERE ratings.entry_id = entries.id) as…
Mike
5
votes
3 answers
Searching in where in rails with or clause for [IN]
I am using this query in rails
here: @album_ids , @country_ids are Arrays
@audios= Audio.where({:album_id => @album_ids, :country_id => @country_ids})
It produces following SQL:
Audio Load (0.3ms) SELECT `audios`.* FROM `audios` WHERE…

vidur punj
- 5,019
- 4
- 46
- 65
4
votes
2 answers
Optimizing SQL "Where" clause for queries with subqueries
Let's say I have the following hypothetical data structure:
create table "country"
(
country_id integer,
country_name varchar(50),
continent varchar(50),
constraint country_pkey primary key (country_id)
);
create table "person"
(
…

clj
- 53
- 1
- 7
4
votes
4 answers
Why [x, y, _] isn't allowed in pattern matching
Here is my code:
tell :: (Show a) => [a] -> String
tell [] = "The list is empty"
tell (x:[]) = "The list has one element: " ++ show x
tell (x:y:[]) = "The list has two elements: " ++ show x ++ " and " ++ show y
tell (x:y:_) = "Other"
in…

Valentin Grigorev
- 135
- 1
- 9
4
votes
5 answers
OR statement handling two != clauses Python
(Using Python 2.7) I understand this is pretty elementary but why wouldn't the following statement work as written:
input = int(raw_input())
while input != 10 or input != 20:
print 'Incorrect value, try again'
bet =…

thebill
- 59
- 1
- 2
- 6
4
votes
2 answers
LINQ where Clause doubt
I have tried one where clause in Linq to get details about Users those who are Active and AllowLogin is also true.
So how can I compare the table values (both are boolean values) with true or false?
sss
4
votes
5 answers
Oracle SQL clause evaluation order
In Oracle, which clause types get evaluated first? If I had the following ( pretend .... represent valid expressions and relation names ), what would the order of evaluation be?
SELECT ...
FROM .....
WHERE ........
GROUP BY…

jon.johnson
- 51
- 1
- 1
- 3
4
votes
1 answer
How can we use Multiple Queries using 'WITH' Clause
as sample code below....
WITH sampleA as (SELECT * FROM emp)
SELECT * FROM sampleA
SELECT * FROM sampleA
this alias 'sampleA' will work for only first query not for second or later..
But I want to query more with this alias only.
Can you…

user3131580
- 41
- 2
3
votes
2 answers
Understanding the clause/2 predicate
I'm currently trying to learn some Prolog (using ECLiPSe). From time to time I come across the clause/2 predicate, but I fail to understand what it is used for. I read some references (e.g. this one), but I still don't get in what case it could be…

Lennart
- 9,657
- 16
- 68
- 84
3
votes
2 answers
MySQL 0 IN ("Some", "Set")
I've got a MySQL query which uses IN clause.
SELECT SomeColumn
FROM SomeTable
WHERE SomeOtherColumn IN ('Some', 'Set')
However, I've stumbled upon a case, where SomeOtherColumn has a value of 0, and MySQL evaluates the where clause as TRUE:
SELECT…

Wunsz
- 165
- 3
- 7
3
votes
1 answer
Prolog - Declaring arithmetic clauses
A simple question, how would I go about declaring a clause which would produce the number specified +1 +2 and +3? I have tried:
addup(Thenumber,Thenumber+1).
addup(Thenumber,Thenumber+2).
addup(Thenumber,Thenumber+3).
but when I run it with say,…

Dororo
- 3,420
- 2
- 30
- 46