Viewing 15 posts - 3,331 through 3,345 (of 4,087 total)
I find that row number works better when you have a single table that you are trying to pull the most recent record from. When you have multiple tables,...
February 8, 2012 at 1:08 pm
SQL Kiwi (2/8/2012)
drew.allen (2/8/2012)
Peter Brinkhaus (2/7/2012)
As an alternative, you could use NOT EXISTS (SELECT [@Stag].* INTERSECT SELECT [@Prod].*) to compare rows.
Using EXCEPT should give you the same results, is probably...
February 8, 2012 at 9:32 am
I don't know if it's "better" than a CTE, but you can use CROSS APPLY
select
A,
...
February 8, 2012 at 8:00 am
Peter Brinkhaus (2/7/2012)
As an alternative, you could use NOT EXISTS (SELECT [@Stag].* INTERSECT SELECT [@Prod].*) to compare rows.
Using EXCEPT should give you the same results, is probably more efficient, and...
February 8, 2012 at 7:22 am
You need to make sure that your literal string is Unicode. Compare the following results where the first literal is ASCII and the second is Unicode.
SELECT 'A a A...
February 1, 2012 at 9:04 am
Take a look at EXCEPT which performs a set difference, which is what you are looking for. It makes it much clearer that you are doing a set difference...
February 1, 2012 at 8:43 am
The SQL query is first compiled and then executed. Some SQL statements will allow you to use optimistic name resolution to refer to objects that have not yet been...
January 30, 2012 at 7:50 am
Use an OUTER APPLY
SELECT m.[property_id]
,m.[Address]
,m.[City]
,m.[Zip]
,m.County
,m.Bedrooms
,m.Bathrooms
,m.HalfBathrooms
,m.[V_O]
,m.[Stars]
,m.Rehab
,m.Open_bid
,m.Notes
,m.date_time_changed
,i.imagepaththumb
FROM [Master] m
OUTER APPLY (
SELECT TOP (1) impagepaththumb
FROM Image
WHERE property_id = property_id_fk
) AS i
where Active_Month='Y'
ORDER BY m.[V_O] DESC
,m.date_time_changed desc
,m.[Address] ASC
You could also use ROW_NUMBER(), but I...
January 30, 2012 at 7:06 am
Martin Schoombee (1/27/2012)
Take note though that it would require a triangular join, which is generally bad for performance.
I wouldn't classify this as a triangular join. A triangular joins assumes...
January 27, 2012 at 8:03 am
mbrady5 (1/26/2012)
How would you like to see some sample data? What format etc?
See the following link.
Forum Etiquette: How to post data/code on a forum to get the best help[/url]
Drew
January 26, 2012 at 11:30 am
In addition, I think you need to change the comparisons on these.
Datediff(dd,receivedDate,getdate()) >= b.Days
AND Datediff(dd,receivedDate,getdate()) < b.Days - 5
By the law of transitivity, if n > d and d...
January 26, 2012 at 9:15 am
Guras (1/26/2012)
I have a table as following TableA
clientcode | days
101 | 30
101 | 60
105 | 15
I need to build the...
January 26, 2012 at 9:06 am
Don't construct SQL commands in SSRS. Create a stored procedure and pass the SSRS parameters into the stored procedure.
Do you really need both a FULL OUTER JOIN and a...
January 26, 2012 at 8:42 am
You're WHERE clause is not SARGable, because of the conversion of the timestamp field to character. Functions on fields generally prevent them from being SARGable, meaning that you cannot...
January 25, 2012 at 9:46 am
Joe's posts on here have convinced me never to buy his books. He believes that he is being authoritative when he's just being authoritarian. He states opinion as...
January 25, 2012 at 7:26 am
Viewing 15 posts - 3,331 through 3,345 (of 4,087 total)