Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
goku123
Starting Member
1 Post |
Posted - 2012-01-24 : 06:35:55
|
| Hi,New here so sorry if i opened a topic already open or something.I'm working on a bookings system called trip and i need to do an sql query.I have the code below which i pasted. It works but it does not give me the correct result that im looking for. I dont know how to solve this. Basically i want to find people that where added to the system between 1st jan 2006 and 1st jan 2012, but have only made a booking between the 3rd jan and 24th jan with no previous bookings ever. Basically first time bookers.Please help. If you need any info then please let me know.Thanksselect distinct zip,aline1, aline2,aline3,aline4, aline5,catgry, town, homes.added7, tdesc, age , dep7,book7,bstatfrom bookingsleft outer join homeson bookings.home = homes.homeleft outer join peopleon homes.home = people.homeleft outer join bnameson people.person = bnames.personwhere (bstat='OK' or bstat='PR')and guests + carers > 0and homes.added between '38718' and '40909'and booked not between '38718' and '40909'and booked between '40911' and '40932'The dude |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-24 : 06:53:18
|
Please make it easier for us to help.Give us table structure, sample data and wanted result in relation to the sample data.maybe like this: No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|