|
Hi All!
I had two table in SQL Server: tblNew_Details and tblNews. They were connected over pass by two fields: New_DetailsID in tblNew_Details with New_DetailsID in tblNews.
I design a Web Form (ASP.NET)which uses a DataList control to list all contents in tblNews table.
I only display a field that have the same New_DetailsID(in tblNews). But I have a problem which display two fields with the same New_DetailsID.
Please help!
Thanks!
|
|
|
|
|
Hi ,
I have two table with one-many relationship
table1 with following fields:ID1(PK),f11,f12..
table 2 :ID1(FK),ID2(PK),f21,f22..
I want to get ONLY ONE ROW after execute SELECT statement from
table1 join table2 via ID1
Can anyone help me!
Thanks in advance
dinhzap84xd@gmail.com
zappa
-- modified at 6:49 Thursday 29th June, 2006
|
|
|
|
|
hi,
table1 with following fields:ID1(PK),f11,f12..
table 2 :ID1(FK),ID2(PK),f21,f22..
select distinct top 1 * from table1 a inner join table2 b on a.ID1=b.ID1
no condition u specified, so this is one way to get only one row
|
|
|
|
|
thanks.I'll test it.
zappa
|
|
|
|
|
I want debug stored procedure. please help me.
hk,linn
|
|
|
|
|
Hi,
Can someone please tell me why the following SELECT statement is bring back no results:
SELECT
WineryID_PK,
WineryName,
WineryEstablishedYear,
WineryOwner,
WineryDescription,
CountryID_PK,
CountryName,
RegionID_PK,
RegionName,
WineryDateInserted,
WineryDateUpdated,
(MemberFName + ' ' + MemberLName) AS WineryUpdatedBy,
WineryStatus,
WineryHasImage
FROM
Winery
LEFT OUTER JOIN Members
ON Winery.WineryUpdatedByID_FK = Members.MemberID_PK
INNER JOIN Region
ON Winery.RegionID_FK = Region.RegionID_PK
INNER JOIN Country
ON Region.CountryID_FK = Country.CountryID_PK
WHERE
Members.MemberUsername = 'Serasmus'
AND WineryID_PK = 20;
If I remove the Members.MemberUsername = 'Serasmus' then it bring back just the winery details, otherwise nothing. Username Serasmus does exist in the members table.
Regards,
Brendan
|
|
|
|
|
U are doing a left join with the winery table on the left side..
so the query will return 'Serasmus' only if this member's id is present in
the WineryUpdatedByID_FK column of winery table..is it?
so ur statement of "Username Serasmus does exist in the members table" is not really helpful
try executing this query part by part ... u may get a solution faster..
|
|
|
|
|
DIMPLE_R wrote: U
DIMPLE_R wrote: ur
Your answer would be easier to read if you wrote properly structured sentences and didn't use "txtspk"
|
|
|
|
|
What is txtspk?? Are you talking to me or to DIMPLE_R?? I understood him 100%!!
|
|
|
|
|
|
ma se wrote: What is txtspk??
AKA SMS Speak.
ma se wrote: Are you talking to me or to DIMPLE_R??
DIMPLE_R, that is why I quoted from his message.
ma se wrote: I understood him 100%!!
Really?? I didn't. It hurt my head.
|
|
|
|
|
Ahhh.. come one, it wasn't that bad, at least he tried helping. I appreciate his reply!
|
|
|
|
|
Thanks, but I was not thinking clearly.
I changed it to the following and it works fine:
SELECT
WineryID_PK,
WineryName,
WineryEstablishedYear,
WineryOwner,
WineryDescription,
CountryID_PK,
CountryName,
RegionID_PK,
RegionName,
WineryDateInserted,
WineryDateUpdated,
(m2.MemberFName + ' ' + m2.MemberLName) AS WineryUpdatedBy,
WineryStatus,
WineryHasImage
FROM
MemberInWinery
INNER JOIN Winery
ON MemberInWinery.WineryID_FK = Winery.WineryID_PK
INNER JOIN Members AS "m1"
ON MemberInWinery.MemberID_FK = m1.MemberID_PK
LEFT OUTER JOIN Members AS "m2"
ON Winery.WineryUpdatedByID_FK = m2.MemberID_PK
INNER JOIN Region
ON Winery.RegionID_FK = Region.RegionID_PK
INNER JOIN Country
ON Region.CountryID_FK = Country.CountryID_PK
WHERE
MemberInWinery.WineryID_FK = 20
AND MemberInWinery.MemberID_FK = 12;
Thanks for your help!!
|
|
|
|
|
hi all,
I am copying a table to another table using
select * into targettable from sourcetable .
The new table named "targettable" is created but the primary key (constraints) and default values for the table are not coming as "sourcetable".
Is there any way to have a table copy with the same table structure and design??????.
vivek
|
|
|
|
|
vivek-g wrote: Urgent
Sorry, but not to us it isn't.
|
|
|
|
|
Currently there is no such method to copy the constraints from the source to target table during table creation. For applying the constraints you must Alter the table.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi,
I would like to find duration in hh:mm format between two dates.
Example:-
Duration between '2006-06-29 09:01:13.637' and '2006-06-29 12:09:13.637'
in HH:MM Format.
Regards
Rajesh
rajesh
|
|
|
|
|
Hi Rajesh,
You may want to take a look at the following articles:
http://blogs.wdevs.com/irtaza/archive/2005/02/04/2195.aspx
http://www.sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk
Hope this helps.
Dimple
|
|
|
|
|
hello,
does anybody know how to write a query that returns the maximum value of a column? here is what i have so far:
<br />
SELECT barcode, wellname, well.ph, proteinname, score, time FROM well INNER JOIN welldrop ON well.wellkey=welldrop.wellkey INNER JOIN imageset ON welldrop.dropkey=imageset.dropkey WHERE well.barcode=1111<br />
this query returns several rows for each "wellkey". i only want to return one row for each wellkey, with the most recent date (found in the time field of the imageset table). i tried using MAX(time), but i got an error...
thanks!
RC
-- modified at 17:20 Wednesday 28th June, 2006
|
|
|
|
|
i think i figured it out. the following serves my purposes:
SELECT barcode, wellname, well.ph, proteinname, score, MAX(time) AS time FROM well INNER JOIN welldrop ON well.wellkey=welldrop.wellkey INNER JOIN imageset ON welldrop.dropkey=imageset.dropkey WHERE well.barcode=1111 GROUP BY barcode,wellname
|
|
|
|
|
This question requires experience with Visual Studio .NET 2005.
I created an n-tiered application and in the Data Access Layer I used a direct connection to the Database by specifying the server, username, password, etc in the connection string. Now I want to change this so that the application connects to the Database through a DSN defined on the local machine that connects to the server.
So I went ahead and changed the connection settings to point to a dsn. The connectio string looks like this after the change:
Dsn=dsnname
But I get an error when the connection is initialized at run time telling me that 'dsn' is not a recognized string in the connection string. Please remember that in both cases I did not generate the connection string manually, VS did it for me.
Any help will be appreciated.
|
|
|
|
|
|
Yes, I did figure it out a few hours ago. The DAL was created using a SqlConnection and since a DSN will utilize an OdbcConnection, the SqlConnection object that was created as part of the project did not recognize it. Since I used a visual editor to change from a SqlConnection to a OdbcConnection, I figured VS.NET will do the work for me. Apparently it doesn't. Thanks for your help.
|
|
|
|
|
I'm trying to find a way to grab a given rows cell information, for now just the primary key, and store it in a variable to use somewhere else. If I use listbox's I can simply use .selectedValue() and it gives me exactly what I need, but in this case, I'm needing to do it with a datagridview and this attribute doesn't exist. Thanks!
|
|
|
|
|
Hi Champs
I am writing DTS first time so need little help.
I need to check 2 columns (Col A and Col B) of Table A .
If there is no entry for these columns for current date then i need to send mails to some recipients same day at 12:00 PM.
*** Can i get the query help *** and any link where i can understand this functionality
Thanks A Lot !!!
|
|
|
|