Question releted to sql query.
-
hi Rahul, you are using distinct blgid and join on blgid so even though thr are 3 same blogtitle but if they have diffrent id it will return 3 records
pallavi
Hi Pallavi, If they have same blogtitle and same id then it will return only one row. Is it correct? Thanks. Rahul.
People Laugh on me Because them i am Different but i Laugh on Because they all are same.
-
Hi Pallavi, If they have same blogtitle and same id then it will return only one row. Is it correct? Thanks. Rahul.
People Laugh on me Because them i am Different but i Laugh on Because they all are same.
Hi Rahul, if you have same ids how will u get 3 records ..its one record na ..:) see in join, u join in which field is matter a lot .. so if u are joining on blogid it must be unique...and so it will have uique ids no matter title same or diffrent. if u have any query plz ask :)
pallavi
-
Hi Rahul, if you have same ids how will u get 3 records ..its one record na ..:) see in join, u join in which field is matter a lot .. so if u are joining on blogid it must be unique...and so it will have uique ids no matter title same or diffrent. if u have any query plz ask :)
pallavi
Thanks Pallavi, Regards Rahul.
People Laugh on me Because i am Different but i Laugh on them Because they all are same.
-
Hi Rahul, if you have same ids how will u get 3 records ..its one record na ..:) see in join, u join in which field is matter a lot .. so if u are joining on blogid it must be unique...and so it will have uique ids no matter title same or diffrent. if u have any query plz ask :)
pallavi
Hi Pallavi, When i run this query in query analyzer it shows me three row with same id.My query is as follow.
select distinct blog_new.blgid,blog_new.blogtitle,blog_new.createddate,blog_post.editeddate from blog_new,blog_post where blog_new.blgid=blog_post.blgid and blog_new.status=1 order by blog_post.editeddate desc
can u tell me why?People Laugh on me Because i am Different but i Laugh on them Because they all are same.
-
Hi Pallavi, When i run this query in query analyzer it shows me three row with same id.My query is as follow.
select distinct blog_new.blgid,blog_new.blogtitle,blog_new.createddate,blog_post.editeddate from blog_new,blog_post where blog_new.blgid=blog_post.blgid and blog_new.status=1 order by blog_post.editeddate desc
can u tell me why?People Laugh on me Because i am Different but i Laugh on them Because they all are same.
Hi Rahul, can u show me out put here .. as i dont know if u r using distinct blgid it is showing 3 records to u ? Do u have one record in first table and 3 records in second table with same ids ?
pallavi
-
Hi Rahul, can u show me out put here .. as i dont know if u r using distinct blgid it is showing 3 records to u ? Do u have one record in first table and 3 records in second table with same ids ?
pallavi
Hi Pallavi here is my output,
3 Exma tips for student 2007-11-18 17:47:17.000 3 Exma tips for student 2007-11-05 15:56:20.950 11 New blog under Exam Study tips 2007-11-05 15:54:17.780 12 This is first blog by user Swati. 2007-11-05 12:39:43.123 13 Blog Created on 11/03/2007 2007-11-03 17:15:38.297 14 This is second blog created by Swati on 11/03/2007. 2007-11-03 17:12:24.437 13 Blog Created on 11/03/2007 2007-11-03 16:32:01.293 12 This is first blog by user Swati. 2007-11-03 11:37:26.170 11 New blog under Exam Study tips 2007-11-02 16:47:43.263 3 Exma tips for student 2007-10-31 14:47:19.107 6 First Blog by NItin 2007-10-30 18:26:12.183 4 New action Movies coming soon 2007-10-29 17:43:20.310 5 Part time jobs 2007-10-29 17:22:20.857 6 First Blog by NItin 2007-10-23 16:01:47.763 5 Part time jobs 2007-10-23 15:21:10.717 1 What are database. 2007-10-20 19:41:14.780 3 Exma tips for student 2007-10-18 17:47:17.000 4 New action Movies coming soon 2007-10-18 17:47:17.000
People Laugh on me Because i am Different but i Laugh on them Because they all are same.
-
Hi Pallavi here is my output,
3 Exma tips for student 2007-11-18 17:47:17.000 3 Exma tips for student 2007-11-05 15:56:20.950 11 New blog under Exam Study tips 2007-11-05 15:54:17.780 12 This is first blog by user Swati. 2007-11-05 12:39:43.123 13 Blog Created on 11/03/2007 2007-11-03 17:15:38.297 14 This is second blog created by Swati on 11/03/2007. 2007-11-03 17:12:24.437 13 Blog Created on 11/03/2007 2007-11-03 16:32:01.293 12 This is first blog by user Swati. 2007-11-03 11:37:26.170 11 New blog under Exam Study tips 2007-11-02 16:47:43.263 3 Exma tips for student 2007-10-31 14:47:19.107 6 First Blog by NItin 2007-10-30 18:26:12.183 4 New action Movies coming soon 2007-10-29 17:43:20.310 5 Part time jobs 2007-10-29 17:22:20.857 6 First Blog by NItin 2007-10-23 16:01:47.763 5 Part time jobs 2007-10-23 15:21:10.717 1 What are database. 2007-10-20 19:41:14.780 3 Exma tips for student 2007-10-18 17:47:17.000 4 New action Movies coming soon 2007-10-18 17:47:17.000
People Laugh on me Because i am Different but i Laugh on them Because they all are same.
hi, can u try query like this .. and tell me what is out put now... select blog_new.blgid,blog_new.blogtitle,blog_new.createddate from blog_new inner join blog_post on blog_new.blgid = blog_post.blgid and blog_new.status= 1 order by blog_post.editeddate desc
pallavi
-
hi, can u try query like this .. and tell me what is out put now... select blog_new.blgid,blog_new.blogtitle,blog_new.createddate from blog_new inner join blog_post on blog_new.blgid = blog_post.blgid and blog_new.status= 1 order by blog_post.editeddate desc
pallavi
Hi Pallavi,(sorry for late rply) I fired query given by u but the result is same.It shows three column with same id. Thanks.
People Laugh on me Because i am Different but i Laugh on them Because they all are same.
-
Hi Pallavi,(sorry for late rply) I fired query given by u but the result is same.It shows three column with same id. Thanks.
People Laugh on me Because i am Different but i Laugh on them Because they all are same.
Hi rahul, can u explain me u r table relationship? means is your first table have blogid as primary key and second table with blogid as forgien key? can u give me few table content of both tables (2, 3 records for both tables)?
pallavi
-
Hi rahul, can u explain me u r table relationship? means is your first table have blogid as primary key and second table with blogid as forgien key? can u give me few table content of both tables (2, 3 records for both tables)?
pallavi
Hi My first table name is Blog_New which having 1)blgid- Primery key 2)blgname- 3) blogtitle 4)createddate 5)editeddate and my second table is Blog_Post 1)postid- primery key 2)blgid- forein key 3)posttitle 4)posttext 5)createeddate 6)status 7)createddate 8)editeddate First three columg of my second table is as follow. first column postid(P.K),second blgid(F.K) and third Posttitle 1 3 Exam tips for 12 std student.(updated) 3 3 This is second post 4 1 This is post for database blog (updated) 5 4 Which are the New action Movie cming this month. 6 3 This is thire post in this blog. 7 5 Part time jobs in Abroad 8 6 How to do timepass. 9 5 Uploading image into Post. 10 4 This is the new image Picture of James 007 11 6 Which is teh best selller book of the year 2007. 12 10 This is my first Post under Sanjay's Blog. 13 3 How to Create a blog. 14 10 This is new post posted on 11/02/2007 15 11 New post under the blog created on 11/02/2007. 16 11 Test for Blog. 17 12 Hi to all i am new here. 18 12 Which are the best natural places in India. 19 13 This is the post in Blog Exam Study tips created on 11/03/2007 20 13 This is second post in Blog Exam Study Tips created on 11/02/2007. 21 14 This is second post in Blog Exam Study Tips created on 11/02/2007. 22 4 This post publish property is set to false. and first three column of my second table is as follow. First column blgid(P.K),userid,third blogtitle 1 4 What are database. 2 4 College Financing. and its Adv 3 4 Exma tips for student 4 4 New action Movies coming soon 5 4 Part time jobs 6 7 First Blog by NItin 7 7 Todays best muxic seller Album 8 4 Which is the best field now a dayz? 9 4 Which is the best field now a dayz? 10 4 Sanjay's Blog 11 4 New blog under Exam Study tips 12 10 This is first blog by user Swati. 13 4 Blog Created on 11/03/2007 14 10 This is second blog created by Swati on 11/03/2007. This is my table structure and its content. Both table contain created and edited date column. Thanks. -- modified at 10:26 Monday 5th November, 2007 -- modified at 10:31 Monday 5th November, 2007
People Laugh on me Because i am Different but i Laugh on them Because they all are same.