Although I know this isn't very efficient, I need to get this working fast so I try to follow the easiest path, or at least I thought so. I'm trying to get the max data out of an entity and take into consideration only the rows where USER is not null, and in case no rows have USER not set to null, then I will take the null ones into cons...
I have these two tables:
tAccounts
id, name, server_id
tFriends
id_lo, id_hi
Now, I'm trying this query:
SELECT FR.id_lo AS id_friend
FROM tFriends FR, tAccounts AC
WHERE (FR.id_hi = 4 && AC.server_id != -1)
........ In order get the friends of a certain user, while making sure his friend's server_id is different than '-1' !
Any i...
Hello all.
I am struggling once again so any help would be gratefully received.
I have the following LINQ that pulls back a list of data:
public static List<tblWeight> GetWeights(string memberid, string locationid, string buyer, string subcategory, string product)
{
MyEntity getweights = new MyEntity ();
...
I have thi next code, but he doesn't work:
$select_sell = $this->select();
$select_sell->from($this->_name, array('rank_id'))
->where('rank_id = ?', $id)
->where('type = ?', 'must_sell');
$result = $this->fetchAll($select_sell)->count();
I need to make this query ... WHERErank_id= $id ANDtype= 'must_sell'..
Th...
Hi,
As I was coding a php page building a MySQL request according to GET parameters, I was wondering if MySQL does any kind of reorganization of WHERE tests in a request, or if it just takes them as they come.
For example, if I execute this request:
SELECT * FROM `table` t WHERE (SELECT `some_value` FROM `another_table` u WHERE `t.id`...
Morning all.
Just a quick one for you - where can I find the SQL that is executed when a LINQ statement fires?
I have the following code that works a treat,
var r = (from p in getproductweightsbuyer.tblWeights
where p.MemberId == memberid &&
p.LocationId == locationid
...
Hello all, me again!
I have the following sp that uses a condtional where clause - ish!
@MemberId varchar(7),
@LocationId varchar(8),
@UUF1 varchar(150),
@UUF2 varchar(50),
@UUF4 varchar(50),
@IDDesc varchar(255),
@OwnBrand nvarchar(50),
@WeightStatus varchar(50),
@MaterialLevel varchar(10),
@BaseMaterialName varchar(15),
@ExtendedMa...
Hello all.
I've got myself in a bit of a pickle!
I've done a snazzy LINQ statement that does the job in my web app, but now I'd like to use this in a stored procedure:
var r = (from p in getautocompleteweightsproducts.tblWeights
where p.MemberId == memberid &&
p.LocationId == location...
select * from table where category=@categoryid
I'm not sure how easy is this but I couldn't get my head around it. I want to be able to change where clause on above query so that if use 0 instead of 1-2-3 or 4 as @categoryid it would select all categories. i don't have any category with 0 in database.
...
I'm getting an array of strings for which I want to see if a certain number of data fields in the domain object have all of those strings. I know the data fields at compile-time but I don't know the size of the array at compile-time.
Is there a way that I can compose a where clause at run-time so that I can do what I'm looking for in a ...
I have a very small entity framework setup containing only a few related classes/tables and a view. I need to be able to pull a specific record from this view, namely, I need to be able to grab the record that meets two criteria, it has a specific ProfileID and a specific QuoteID.
This line is what's causing the problem:
TWProfileUpcha...
How would I get something like this to work so that I can dynamically alter the where-clause in this linq to sql query?
Dim AccountID = 1234
Dim AccountList
Select Case Types
Case 1
AccountList = (from a in dc.Accounts where a.ID = AccountID)
Case 2
AccountList = (from a in dc.Accounts where a.ID = AccountID An...
I need a regex that will determine if a given SQL statement has a WHERE clause. My problem is that the passed SQL statements will most likely be complex, so I can not rely on just the existence of the word WHERE in the statement.
For example this should match
SELECT Contacts.ID
, CASE WHEN (Contacts.Firstname IS NULL) THEN ''
...
In terms of performance, how does the like operator behaves when applied to strings with multiple % placeholders?
for example:
select A from table_A where A like 'A%'
takes the same time to select than
select A from table_A where A like 'A%%'
???
...
I am working on a project that obtains values from many measurement stations (e.g. 50000) located all over the world. I have 2 databases, one storing information on the measurement stations, the other one storing values obtained from these stations (e.g. several million). A super-simplified version of the database structure could look li...
Help me understand this: In the sqlzoo tutorial for question 3a ("Find the largest country in each region"), why does attaching 'AND population > 0' to the nested SELECT statement make this correct?
...
what is the different from this mysql query:
WHERE MONTH(date) = MONTH(CURRENT_DATE)
and this
WHERE date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) AND CURRENT_DATE()
i have tried both but i cant see the different.
...
lets say i have two drop down list and one button on my search page:
From
<select id="1stdate">
Until
<select id="2nddate">
<input type="button" id="search">
i want to search data from 1stdate until 2nddate, how to use WHERE CLAUSE for this case? for ex. i want to search data "from 09-2010 until 11-2010".
this my query:
SELECT CONCAT...
how to deal with NULL value in mysql where in CLAUSE
i try like
SELECT * FROM mytable WHERE field IN(1,2,3,NULL)
it not working
only work like :
SELECT * FROM mytable WHERE field IN(1,2,3) OR field IS NULL
how can i get it work in WHERE IN ? it is possible ?
...
I have got SQL Server database in which Table column name have spaces. For example I have a Table something like this:
ID| First Name| Last Name|Birth Date
1 | Wasim | Akram | 01-01-2000
2 | Saeed | Anwer | 01-01-2001
Now When I use a following query(column name with space) I get empty result:
SELECT * FROM table WHERE...