question

siddaram avatar image
siddaram asked

How to get result without joining the tables

CREATE TABLE #tempIDs(ID INT) GO CREATE TABLE tblMobileNumbers ( ID INT IDENTITY(1,1),Mobile VARCHAR(100),Messagebody VARCHAR(MAX) ,FirstName VARCHAR(100),LastName VARCHAR(MAX) ) GO SELECT * FROM #tempIDs Result : ID 10021 10022 SELECT * FROM tblMobileNumbers Result : ID Mobile Messgebody FirstName LastName ----------------------------------------------------------------------------------------------------------------------------------- 1 10000001 Message1 MyFirstName10000001 MyLastName10000001 2 10000002 Message1 MyFirstName10000002 MyLastName10000002 Final Result should be :??? ---------------------------------------------- 1 10021 MyFirstName10000001 MyLastName10000001 10000001 1 GETDATE() 1 10022 MyFirstName10000002 MyLastName10000002 10000002 1 GETDATE() firstcolumn and sixth columns have constant value in the above result
selectjoin
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

how do the values in #tempIDs relate to the data in tblMobileNumbers?
1 Like 1 ·

1 Answer

· Write an Answer
cornpoppy avatar image
cornpoppy answered
select tblMobile.ID, temp.ID,FirstName,LastName,Mobile, tblMobile.ID,getdate() dateNow from #tempIDs temp,#tblMobileNumbers tblMobile order by tblMobile.ID
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.