Forum: MS SQL Nov 19th, 2008 |
| Replies: 6 Views: 2,619 While I don't want to discourage new members, you might want to look at the dates of previous messages. This thread has been dead for 2 and a half years. |
Forum: MS SQL May 9th, 2008 |
| Replies: 3 Views: 8,123 ignore that last one and try this instead
Select pt.ProductID
from Products pt
left join Rating RT
on pt.productid = rt.productid
group by pt.productid
order by IsNull(Min(rt.Rating),0) |
Forum: MS SQL May 9th, 2008 |
| Replies: 3 Views: 8,123 I think you want something like this
Select distinct pt.ProductID
from Products pt
left join Rating RT
on pt.productid = rt.productid
order by IsNull(Min(rt.Rating),0) |
Forum: MS SQL May 9th, 2008 |
| Replies: 1 Views: 1,401 get rid of the square brackets around the varchar(255) and it will work fine.
For that matter, why are you putting them around the datatypes anyway? I've never seen anyone do that. |
Forum: MS SQL May 9th, 2008 |
| Replies: 3 Views: 3,883 select * from persons where (prefix like '%'+@input+'%'
or
firstname like '%'+@input+'%'
or
lastname like '%'+@input+'%')
and address like '%'+@addressinput+'%' |
Forum: MS SQL May 9th, 2008 |
| Replies: 1 Views: 3,892 This isn't a problem as I have already solved the problem, just trying to figure out why it happened.
Ok I have a field that is type money. I wrote a stored procedure that updates this field,... |
Forum: MS SQL Jan 24th, 2008 |
| Replies: 5 Views: 937 that would add the assumption that the names in b are the first letter of the names in a |
Forum: MS SQL Jan 24th, 2008 |
| Replies: 5 Views: 937 ok, i am assuming that you want a name for all id's. if a has an entry use that, otherwise use the name from b. also assuming that B has an entry for every id. if those assumptions are correct,... |
Forum: MS SQL May 22nd, 2007 |
| Replies: 5 Views: 1,245 I don't have time to test this, but i don't think that this will work. This won't show any id1's that don't have a matching id2 or any id2's that don't have a matching one |
Forum: MS SQL May 21st, 2007 |
| Replies: 5 Views: 1,245 select distinct case when id1<id2 then id1 else id2 end, case when id1<id2 then id2 else id1 end from tablename |
Forum: MS SQL May 18th, 2007 |
| Replies: 7 Views: 4,475 um, yes you can. I have Windows XP Pro with SQL Server 2000 installed on it. |
Forum: MS SQL May 11th, 2007 |
| Replies: 7 Views: 4,475 |
Forum: MS SQL May 9th, 2007 |
| Replies: 2 Views: 1,142 I agree that storing images in your database is probably not the best way to do it. But it is possible. Look into BLOB's (binary large object) |
Forum: MS SQL May 3rd, 2007 |
| Replies: 1 Views: 1,234 it think this should work
select nick, max(energy.dateposted) from users
join energy
on energy.userid = user.id
group by nick |
Forum: MS SQL Feb 23rd, 2007 |
| Replies: 1 Views: 4,244 there's probably a more efficient way but this should work
select max(empsal) from employees where empno not in (select top 3 empno from employees order by empsal desc) |
Forum: MS SQL Feb 9th, 2007 |
| Replies: 3 Views: 3,673 only other way that you might make it faster is to split the tables by type
eg have a SudokuGameList table and a CrosswordGameList table, ditto for history
but I really think that, with the... |
Forum: MS SQL Feb 9th, 2007 |
| Replies: 3 Views: 3,673 sounds like a reasonable setup. Best bet is to make sure it is indexed properly |
Forum: MS SQL Feb 6th, 2007 |
| Replies: 5 Views: 2,126 give an example of what you are trying to do |
Forum: MS SQL Jan 12th, 2007 |
| Replies: 2 Views: 5,173 1) I am in the process of doing this right now and so far it has been relatively painless. There are some minor tweaks you may have to make, but it is pretty easy to convert. Two problems we have... |
Forum: MS SQL Jan 11th, 2007 |
| Replies: 3 Views: 7,033 |
Forum: MS SQL Jan 11th, 2007 |
| Replies: 3 Views: 7,033 not 100% sure what you are going for, but hopefully one of these will either do it for you or get you going in the right direction
1. this will give you each person and their max
select... |
Forum: MS SQL Jan 5th, 2007 |
| Replies: 3 Views: 3,350 from a practical standpoint, I had this happen on a database with an int identity column. You will get an arithmetic overflow exception. Since we are purging and only keep 60-70 million rows at a... |
Forum: MS SQL Dec 20th, 2006 |
| Replies: 2 Views: 2,687 this seems more like a code problem than an sql problem. try posting in the appropriate forum for the language you are using. (vbscript?) |
Forum: MS SQL Dec 20th, 2006 |
| Replies: 3 Views: 4,138 you want to use dynamic sql
DECLARE @STA as char(50)
SET @STA = '''TT'', ''DD'''
exec ('SELECT * FROM ABC_TBL where ABC_Filed in ('+'@STA')') |
Forum: MS SQL Dec 20th, 2006 |
| Replies: 1 Views: 3,623 |
Forum: MS SQL Oct 19th, 2006 |
| Replies: 5 Views: 5,149 does this work for you?
SELECT RNO,PNAME,AGE
FROM TAB1
WHERE enroll_status in ('D','A','Q') |
Forum: MS SQL Oct 10th, 2006 |
| Replies: 5 Views: 5,149 post the queries for the 3 lists and I should be able to help you do one query to get the combined list |
Forum: MS SQL Sep 12th, 2006 |
| Replies: 2 Views: 1,911 actually, that one will only work if there is something in cat a
this will work better
select distinct main.id, a.name, b.name, c.name
from tablename main
left join tablename a on main.id... |
Forum: MS SQL Sep 12th, 2006 |
| Replies: 2 Views: 1,911 this is what you want
select a.id, a.name, b.name, c.name
from tablename a
left join tablename b on a.id = b.id and b.cat = 'b'
left join tablename c on a.id = c.id and c.cat = 'c'
where... |
Forum: MS SQL Sep 12th, 2006 |
| Replies: 3 Views: 4,788 the problem with you original query was precedence
what you need is
WHERE (CHKCANCEL = '0') AND (DITD IS NULL) AND( (CUSTOMERID = '52') OR
(CUSTOMERID = '62') OR
... |
Forum: MS SQL Jul 21st, 2006 |
| Replies: 5 Views: 18,665 correct. 4 bytes * 8 bits = 32 bits. hence it has a range from -2^31 to +2^31 |
Forum: MS SQL Jul 21st, 2006 |
| Replies: 5 Views: 18,665 you are confused, int is not limited to less than 10,000 in sql server. the limit is around 2 billion. (2^31)-1 to be precise |
Forum: MS SQL Jul 10th, 2006 |
| Replies: 1 Views: 1,408 well for stored procedures, just right click on them and click properties
for the triggers, right click on the table, then go to all-tasks and click on manage triggers |
Forum: MS SQL Jul 7th, 2006 |
| Replies: 7 Views: 11,597 are they stored in the time column, or their own column |
Forum: MS SQL Jul 6th, 2006 |
| Replies: 7 Views: 11,597 also, do you need minutes? |
Forum: MS SQL Jul 6th, 2006 |
| Replies: 7 Views: 11,597 and I suppose changing the database is out of the question? |
Forum: MS SQL Jul 5th, 2006 |
| Replies: 7 Views: 11,597 ok, let's start from scratch. give me a brief description of what exactly you are trying to accomplish. including field types and names
something like
I have three columns: workerid, begin_time... |
Forum: MS SQL Jun 6th, 2006 |
| Replies: 5 Views: 1,734 the way you want to do it, I don't know of a way without knowing the criteria you are sorting by and the table schema.
if you have a primary key and are sorting by that primary key,
example table... |
Forum: MS SQL Jun 5th, 2006 |
| Replies: 5 Views: 1,734 sorry, couldn't resist. Will need table schema to answer your question |
Forum: MS SQL Jun 5th, 2006 |
| Replies: 5 Views: 1,734 |