I want to make a generic class that accepts only serializable classes, can it be done with the where constraint?
The concept I'm looking for is this:
public class MyClass<T> where T : //[is serializable/has the serializable attribute]
...
I don't know if this is possible or not, or if my limited knowledge of MDX is pushing me in the wrong direction...
The cube I'm dealing with has two different dimensions for dates, [Statement Dates] and [Premium Dates]. Further in the hierarchy of each looks like this:
[Statement Dates].[Statement Year].[2008]
[Payment Dates].[Payment...
I have the following (shortened query):
SELECT
`Statistics`.`StatisticID`,
COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount`
FROM `Statistics`
LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID`
WHERE `FlagCount` = 0
GROUP BY `Statistics`.`StatisticID`
ORDER BY `SubmittedTime` DESC
LIMIT 0, 10
Now, neither...
Bear with me, I'm beginning: How can I select multiple elements using a WHERE...IN... type of clause as in
select * from orders where orderid in (1, 4, 5)
in LinqToSql? I'd prefer not to have a lambda expression since they scare me. Thanks in advance!
...
Using MySQL syntax and having a table with a row like:
mydate DATETIME NULL,
Is there a way to do something like:
... WHERE mydate<='2008-11-25';
I'm trying but not really getting it to work.
...
Is there a way that I can do a select as such
select * from attributes where product_id = 500
would return
id name description
1 wheel round and black
2 horn makes loud noise
3 window solid object you can see through
and the query
select * from attributes where product_id = 234
would return the same results ...
I have a set of conditions in my where clause like
WHERE
d.attribute3 = 'abcd*'
AND x.STATUS != 'P'
AND x.STATUS != 'J'
AND x.STATUS != 'X'
AND x.STATUS != 'S'
AND x.STATUS != 'D'
AND CURRENT_TIMESTAMP - 1 < x.CREATION_TIMESTAMP
Which of these conditions will be executed first? I am using oracle.
Will I get these details in m...
I don't know how to save object with where clause. I need it to prevent saving object with range of dates overlapping on others.
public class TaskEvent
{
public DateTime StartDate {get;set;}
public DateTime EndDate {get;set;}
}
I want to check overlaping in criteria within saving operation but I don't know how.
Any ideas?
...
Hi there,
I have a Stored Procedure called spGetOrders which accepts a few parameters: @startdate and @enddate. This queries an "Orders" table. One of the columns in the table is called "ClosedDate". This column will hold NULL if an order hasn't been closed or a date value if it has. I'd like to add a @Closed parameter which will ta...
Is there an elegant way to do this:
SELECT Cols from MyTable WHERE
zip = 90210 OR
zip = 23310 OR
zip = 74245 OR
zip = 77427 OR
zip = 18817 OR
zip = 94566 OR
zip = 34533 OR
zip = 96322 OR
zip = 34566 OR
zip = 52214 OR
zip = 73455 OR
zip = 52675 OR
zip = 54724 OR
zip = 98566 OR
zip = 92344 OR
zip = 90432 OR
zip = 91532 OR
...
(zip codes...
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?
...
Hi, I've got a funny question for you, sql gurus out there (or maybe inhere?).
I got this habit when I need to construct a query at runtime. In order to avoid multiple 'if' checks I just go and write 'where true '. Then the rest is another part of the clause in the form, of course of ' and true ...' and continues with useful filtering. ...
I have a MySQL query like this:
SELECT *, SUM(...some SQL removed for brevety) AS Occurrences FROM some_table AS q
WHERE criterion="value" GROUP BY q.P_id ORDER BY Occurrences DESC LIMIT 10;
I want to restrict the results to rows where Occurrences>0. This seems very simple to me, but I can't seem to make it work. No matter what I tr...
Hey there
I have a pretty complex database with loads of different tables for different things, every thing of which has a timestamp (Y-M-D h:m:s format)
Is there a way I can limit my SQL query to just results from a certain timespan, for example a week ago?
If needbe I have a function to convert these timestamps into unix as
sqlToUn...
for example this query:
Select
product_brand,
(CASE WHEN COUNT(product_brand)>50 THEN 1 ELSE 0 END) AS brand_count
FROM
products
WHERE
1
GROUP BY
product_brand
This brings up 2 columns one called product_brand and one called brand_count, brand_count is created on the fly and is always 1 or 0 depending on wh...
Let's say I have Plans and Documents
Dim myPlans = _context.Plans.Where(predicate1)
Dim myDocuments = _context.Documents.Where(predicate2)
I have structured the where clause for each using PredicateBuilder. So, myPlans and myDocuments have a correct SQL statement.
What I'd like to do is join these two tables into one linq statement. ...
I'm building a SqlQuery to support an ad-hoc query screen.
I want something like this:
SqlQuery q = new Select().From<VwInstitutes>();
if (!string.IsNullOrEmpty(username))
{
q.Where(VwInstitutes.Columns.AssignedUser).IsEqualTo(username);
}
if (!string.IsNullOrEmpty(stage))
{
q.Where(VwInstitutes.Columns.Stage).IsEqualTo(stage...
I have two tables parent and child (related as such on PK/FK GUID)
Child has a Timestamp (the record creation date/time).
What I want to do is get only the most recent child record AND the parent record, FOR EACH parent record.
SELECT
dbo_Parents.ParentName,
dbo_ChildEntry.CountPropertys,
dbo_ChildEntry.DateTimeStamp
FR...
Hello,
In my program, we store a user's IP address in a record. When we display a list of records to a user, we don't want to give away the other user's IP, so we SHA1 hash it. Then, when the user clicks on a record, it goes to a URL like this:
http://www.example.com/allrecordsbyipaddress.php?ipaddress=SHA1HASHOFTHEIPADDRESS
Now, I ne...
Hey all, just a quick question (should be an easy fix I think). In a WHERE statement in a query, is there a way to have multiple columns contained inside? Here is my code:
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and pwd='$pass'";
What I want to do is add another column after the WHERE (called priv_level = '$privle...