That makes sense. Thank you! I was beginning to thank that I was going to have to do a loop thru the data to make it work.
I'm not used to making multiple joins and that was exactly what I needed that you pointed out.
Thank you so much george!!
Been working on this for a couple of days, and I switched things around. Now I have it work (I think), but it's in the reverse, it displays only the viewed messages.
SELECT Messages_Admin.Subject, Messages_Admin.Message, Messages_Admin.CreatedDate, Messages_Admin.Createdby...
PS: there is also a org_ID field in table 1 which is only for segregating organizations but doesnt effect my output I just didnt include it in the example (incase you look at the code in my first question).
Table 1
Subject nvarchar(50)
Message nvarchar(Max)
CreatedBy nvarchar(50)
CreatedDate datetime
Msg_ID int (identity)
Table 2
User nvachar(50)
Msg_ID int
Viewed bit
VDate datetime
Table 1 Data
Subject: Hello World
Message: What a great snowy day in Dallas
Createby: Dalec
CreatedDate...
Ok, I think I've made myself nutty.
I just can't get the results I want and my mind has officially turned to clay.
What I have is a table that has a simple text field to store messages then I have a second table with user names that have viewed the message. The first table has a msgID and once...
Strange issue.
I have a sql statement that returns a set of rows for a datagrid (which works correctly).
I have the same criteria to get a count of rows in a stored procedure.
My problem is when I get the count from the stored procedure it always returns the number of records, but, the sql...
Thanks for that, don't know how I did that? Now I get a incorrect syntax near '>'
Current Code:
PROCEDURE Main_InvSch
@NameSch nvarchar(70)
as
SELECT * from Main_inventory
inner join (
select category
from Main_Inventory
where [descrip] = charindex(@NameSch...
Here is what I ended up with:
PROCEDURE Main_InvSch
@NameSch nvarchar(70)
as
SELECT * from Main_inventory
inner join {
select category
from Main_Inventory
where header = 1 and
description = charindex(@NameSch, [descrip]) > 0
} as CategoryQuery
on...
Thank you, I'll play around with this in the SP. I've always used standard query's and was really hoping for SQL to do the work on this one. This really helps. Thank you for the great explanation too.
Dale
thank you Ryan
Could you explain this a little. I'm getting most of it, looking in the entire table, sub query on header = 0 and with a search on category where the category = the category of a temp table?
Sorry if I'm missing something, I've just not done query's like this.
thanks in advance.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.